Merge branch 'dev' into 8664-refactorCmrList
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
34e7c4203f
|
@ -26,6 +26,7 @@ node {
|
|||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||
echo "CHANGE_TARGET: ${env.CHANGE_TARGET}"
|
||||
|
||||
configFileProvider([
|
||||
configFile(fileId: 'salix-front.properties',
|
||||
|
@ -107,16 +108,19 @@ pipeline {
|
|||
}
|
||||
stage('E2E') {
|
||||
environment {
|
||||
CREDENTIALS = credentials('docker-registry')
|
||||
CREDS = credentials('docker-registry')
|
||||
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
|
||||
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sh 'rm junit/e2e-*.xml || true'
|
||||
sh 'rm -f junit/e2e-*.xml'
|
||||
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
|
||||
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||
|
||||
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
|
||||
|
||||
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
|
||||
sh 'cypress run --browser chromium || true'
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "25.10.0",
|
||||
"version": "25.12.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
@ -71,4 +71,4 @@
|
|||
"vite": "^6.0.11",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -124,7 +124,7 @@ const selectTravel = ({ id }) => {
|
|||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
|
|
@ -12,7 +12,7 @@ defineProps({ row: { type: Object, required: true } });
|
|||
>
|
||||
<QIcon name="vn:claims" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('ticketSale.claim') }}:
|
||||
{{ $t('ticketSale.claim') }}:
|
||||
{{ row.claim?.claimFk }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
|
@ -29,14 +29,14 @@ defineProps({ row: { type: Object, required: true } });
|
|||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row?.risk"
|
||||
v-if="row?.hasRisk"
|
||||
name="vn:risk"
|
||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ $t('salesTicketsTable.risk') }}:
|
||||
{{ toCurrency(row.risk - row.credit) }}
|
||||
{{ toCurrency(row.risk - (row.credit ?? 0)) }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
|
|
|
@ -55,6 +55,10 @@ const $props = defineProps({
|
|||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
rowCtrlClick: {
|
||||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
redirect: {
|
||||
type: String,
|
||||
default: null,
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<script setup>
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { QInput } from 'quasar';
|
||||
import { nextTick, ref } from 'vue';
|
||||
import VnInput from './VnInput.vue';
|
||||
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
|
||||
|
||||
const $props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
insertable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -14,70 +11,25 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||
const model = defineModel({ prop: 'modelValue' });
|
||||
const inputRef = ref(false);
|
||||
|
||||
let internalValue = ref($props.modelValue);
|
||||
|
||||
watch(
|
||||
() => $props.modelValue,
|
||||
(newVal) => {
|
||||
internalValue.value = newVal;
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => internalValue.value,
|
||||
(newVal) => {
|
||||
emit('update:modelValue', newVal);
|
||||
accountShortToStandard();
|
||||
}
|
||||
);
|
||||
|
||||
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);
|
||||
function setCursorPosition(pos) {
|
||||
const input = inputRef.value.vnInputRef.$el.querySelector('input');
|
||||
input.focus();
|
||||
input.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() {
|
||||
internalValue.value = internalValue.value?.replace(
|
||||
'.',
|
||||
'0'.repeat(11 - internalValue.value.length)
|
||||
);
|
||||
|
||||
async function handleUpdateModel(val) {
|
||||
model.value = val?.at(-1) === '.' ? useAccountShortToStandard(val) : val;
|
||||
await nextTick(() => setCursorPosition(0));
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
||||
<VnInput
|
||||
v-model="model"
|
||||
ref="inputRef"
|
||||
:insertable
|
||||
@update:model-value="handleUpdateModel"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -83,7 +83,7 @@ const mixinRules = [
|
|||
requiredFieldRule,
|
||||
...($attrs.rules ?? []),
|
||||
(val) => {
|
||||
const { maxlength } = vnInputRef.value;
|
||||
const maxlength = $props.maxlength;
|
||||
if (maxlength && +val.length > maxlength)
|
||||
return t(`maxLength`, { value: maxlength });
|
||||
const { min, max } = vnInputRef.value.$attrs;
|
||||
|
@ -108,7 +108,7 @@ const handleInsertMode = (e) => {
|
|||
e.preventDefault();
|
||||
const input = e.target;
|
||||
const cursorPos = input.selectionStart;
|
||||
const { maxlength } = vnInputRef.value;
|
||||
const maxlength = $props.maxlength;
|
||||
let currentValue = value.value;
|
||||
if (!currentValue) currentValue = e.key;
|
||||
const newValue = e.key;
|
||||
|
@ -143,7 +143,7 @@ const handleUppercase = () => {
|
|||
:rules="mixinRules"
|
||||
:lazy-rules="true"
|
||||
hide-bottom-space
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_input'"
|
||||
>
|
||||
<template #prepend v-if="$slots.prepend">
|
||||
<slot name="prepend" />
|
||||
|
|
|
@ -302,6 +302,8 @@ defineExpose({ opts: myOptions, vnSelectRef });
|
|||
|
||||
function handleKeyDown(event) {
|
||||
if (event.key === 'Tab' && !event.shiftKey) {
|
||||
event.preventDefault();
|
||||
|
||||
const inputValue = vnSelectRef.value?.inputValue;
|
||||
|
||||
if (inputValue) {
|
||||
|
|
|
@ -132,7 +132,8 @@ const card = toRef(props, 'item');
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
white-space: nowrap;
|
||||
width: 192px;
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
|
@ -18,12 +18,7 @@ import VnInput from 'components/common/VnInput.vue';
|
|||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
const originalAttrs = useAttrs();
|
||||
|
||||
const $attrs = computed(() => {
|
||||
const { style, ...rest } = originalAttrs;
|
||||
return rest;
|
||||
});
|
||||
const $attrs = useAttrs();
|
||||
|
||||
const isRequired = computed(() => {
|
||||
return Object.keys($attrs).includes('required');
|
||||
|
|
|
@ -245,7 +245,7 @@ export function useArrayData(key, userOptions) {
|
|||
async function loadMore() {
|
||||
if (!store.hasMoreData) return;
|
||||
|
||||
store.skip = store.limit * store.page;
|
||||
store.skip = (store?.filter?.limit ?? store.limit) * store.page;
|
||||
store.page += 1;
|
||||
|
||||
await fetch({ append: true });
|
||||
|
|
|
@ -369,6 +369,7 @@ globals:
|
|||
countryFk: Country
|
||||
countryCodeFk: Country
|
||||
companyFk: Company
|
||||
nickname: Alias
|
||||
model: Model
|
||||
fuel: Fuel
|
||||
active: Active
|
||||
|
|
|
@ -370,6 +370,7 @@ globals:
|
|||
countryFk: País
|
||||
countryCodeFk: País
|
||||
companyFk: Empresa
|
||||
nickname: Alias
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
|
|
@ -210,6 +210,7 @@ function onDrag() {
|
|||
class="all-pointer-events absolute delete-button zindex"
|
||||
@click.stop="viewDeleteDms(index)"
|
||||
round
|
||||
:data-cy="`delete-button-${index+1}`"
|
||||
/>
|
||||
<QIcon
|
||||
name="play_circle"
|
||||
|
@ -227,6 +228,7 @@ function onDrag() {
|
|||
class="rounded-borders cursor-pointer fit"
|
||||
@click="openDialog(media.dmsFk)"
|
||||
v-if="!media.isVideo"
|
||||
:data-cy="`file-${index+1}`"
|
||||
>
|
||||
</QImg>
|
||||
<video
|
||||
|
@ -235,6 +237,7 @@ function onDrag() {
|
|||
muted="muted"
|
||||
v-if="media.isVideo"
|
||||
@click="openDialog(media.dmsFk)"
|
||||
:data-cy="`file-${index+1}`"
|
||||
/>
|
||||
</QCard>
|
||||
</div>
|
||||
|
|
|
@ -118,14 +118,6 @@ const debtWarning = computed(() => {
|
|||
>
|
||||
<QTooltip>{{ t('Allowed substitution') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="customer?.isFreezed"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="!entity.account?.active"
|
||||
color="primary"
|
||||
|
@ -150,6 +142,14 @@ const debtWarning = computed(() => {
|
|||
>
|
||||
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity?.isFreezed"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QBtn
|
||||
v-if="entity.unpaid"
|
||||
flat
|
||||
|
@ -163,13 +163,13 @@ const debtWarning = computed(() => {
|
|||
<br />
|
||||
{{
|
||||
t('unpaidDated', {
|
||||
dated: toDate(customer.unpaid?.dated),
|
||||
dated: toDate(entity.unpaid?.dated),
|
||||
})
|
||||
}}
|
||||
<br />
|
||||
{{
|
||||
t('unpaidAmount', {
|
||||
amount: toCurrency(customer.unpaid?.amount),
|
||||
amount: toCurrency(entity.unpaid?.amount),
|
||||
})
|
||||
}}
|
||||
</QTooltip>
|
||||
|
|
|
@ -17,7 +17,15 @@ describe('getAddresses', () => {
|
|||
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
|
||||
include: [
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['defaultAddressFk'],
|
||||
},
|
||||
},
|
||||
],
|
||||
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
|
||||
where: { isActive: true },
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||
}),
|
||||
|
|
|
@ -4,7 +4,15 @@ export async function getAddresses(clientId, _filter = {}) {
|
|||
if (!clientId) return;
|
||||
const filter = {
|
||||
..._filter,
|
||||
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
|
||||
include: [
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['defaultAddressFk'],
|
||||
},
|
||||
},
|
||||
],
|
||||
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
|
||||
where: { isActive: true },
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||
};
|
||||
|
|
|
@ -145,6 +145,7 @@ const entryFilterPanel = ref();
|
|||
v-model="params.agencyModeId"
|
||||
@update:model-value="searchFn()"
|
||||
url="AgencyModes"
|
||||
sort-by="name ASC"
|
||||
:fields="['id', 'name']"
|
||||
hide-selected
|
||||
dense
|
||||
|
|
|
@ -94,6 +94,7 @@ const submit = async (rows) => {
|
|||
icon="add_circle"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
data-cy="addBarcode_input"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add barcode') }}
|
||||
|
|
|
@ -226,7 +226,6 @@ const onDenyAccept = (_, responseData) => {
|
|||
order="shipped ASC, isOk ASC"
|
||||
:columns="columns"
|
||||
:user-params="userParams"
|
||||
:is-editable="true"
|
||||
:right-search="false"
|
||||
auto-load
|
||||
:disable-option="{ card: true }"
|
||||
|
|
|
@ -17,6 +17,7 @@ import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
|||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
import useOpenURL from 'src/composables/useOpenURL';
|
||||
|
||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000;
|
||||
const { t } = useI18n();
|
||||
|
@ -321,8 +322,7 @@ const totalPriceColor = (ticket) => {
|
|||
if (total > 0 && total < 50) return 'warning';
|
||||
};
|
||||
|
||||
const openTab = (id) =>
|
||||
window.open(`#/ticket/${id}/sale`, '_blank', 'noopener, noreferrer');
|
||||
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -397,6 +397,7 @@ const openTab = (id) =>
|
|||
default-mode="table"
|
||||
auto-load
|
||||
:row-click="({ id }) => openTab(id)"
|
||||
:row-ctrl-click="(_, { id }) => openTab(id)"
|
||||
:disable-option="{ card: true }"
|
||||
:user-params="{ from, to, scopeDays: 0 }"
|
||||
>
|
||||
|
|
|
@ -22,7 +22,7 @@ salesTicketsTable:
|
|||
notVisible: Not visible
|
||||
purchaseRequest: Purchase request
|
||||
clientFrozen: Client frozen
|
||||
risk: Risk
|
||||
risk: Excess risk
|
||||
componentLack: Component lack
|
||||
tooLittle: Ticket too little
|
||||
identifier: Identifier
|
||||
|
|
|
@ -22,7 +22,7 @@ salesTicketsTable:
|
|||
notVisible: No visible
|
||||
purchaseRequest: Petición de compra
|
||||
clientFrozen: Cliente congelado
|
||||
risk: Riesgo
|
||||
risk: Exceso de riesgo
|
||||
componentLack: Faltan componentes
|
||||
tooLittle: Ticket demasiado pequeño
|
||||
identifier: Identificador
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { computed, ref, onMounted, watch } from 'vue';
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
|
@ -16,6 +16,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
|
|||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import { getAddresses } from '../Customer/composables/getAddresses';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
@ -24,6 +25,11 @@ const agencyList = ref([]);
|
|||
const route = useRoute();
|
||||
const addressOptions = ref([]);
|
||||
const dataKey = 'OrderList';
|
||||
const formInitialData = ref({
|
||||
active: true,
|
||||
addressId: null,
|
||||
clientFk: null,
|
||||
});
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
|
@ -147,32 +153,41 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
onMounted(() => {
|
||||
if (!route.query.createForm) return;
|
||||
const clientId = route.query.createForm;
|
||||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk);
|
||||
onMounted(async () => {
|
||||
if (!route.query) return;
|
||||
if (route.query?.createForm) {
|
||||
const query = JSON.parse(route.query?.createForm);
|
||||
formInitialData.value = query;
|
||||
await onClientSelected({ ...formInitialData.value, clientId: query?.clientFk });
|
||||
} else if (route.query?.table) {
|
||||
const query = JSON.parse(route.query?.table);
|
||||
const clientId = query?.clientFk;
|
||||
if (clientId) await onClientSelected({ clientId });
|
||||
}
|
||||
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
|
||||
});
|
||||
|
||||
async function fetchClientAddress(id, formData = {}) {
|
||||
const { data } = await axios.get(`Clients/${id}/addresses`, {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
include: [
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['defaultAddressFk'],
|
||||
},
|
||||
},
|
||||
],
|
||||
order: ['isActive DESC'],
|
||||
}),
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => route.query.table,
|
||||
async (newValue) => {
|
||||
if (newValue) {
|
||||
const clientId = +JSON.parse(newValue)?.clientFk;
|
||||
if (clientId) await onClientSelected({ clientId });
|
||||
if (tableRef.value)
|
||||
tableRef.value.create.formInitialData = formInitialData.value;
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
async function onClientSelected({ clientId: id }, formData = {}) {
|
||||
const { data } = await getAddresses(id);
|
||||
addressOptions.value = data;
|
||||
formData.addressId = data[0].client.defaultAddressFk;
|
||||
fetchAgencies(formData);
|
||||
formData.defaultAddressFk = data[0].client.defaultAddressFk;
|
||||
formData.addressId = formData.defaultAddressFk;
|
||||
|
||||
formInitialData.value = { addressId: formData.addressId, clientFk: id };
|
||||
await fetchAgencies(formData);
|
||||
}
|
||||
|
||||
async function fetchAgencies({ landed, addressId }) {
|
||||
|
@ -181,7 +196,7 @@ async function fetchAgencies({ landed, addressId }) {
|
|||
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
order: ['agencyMode DESC', 'agencyModeFk ASC'],
|
||||
order: ['name ASC', 'agencyMode DESC', 'agencyModeFk ASC'],
|
||||
}),
|
||||
addressFk: addressId,
|
||||
landed,
|
||||
|
@ -224,11 +239,7 @@ const getDateColor = (date) => {
|
|||
onDataSaved: (url) => {
|
||||
tableRef.redirect(`${url}/catalog`);
|
||||
},
|
||||
formInitialData: {
|
||||
active: true,
|
||||
addressId: null,
|
||||
clientFk: null,
|
||||
},
|
||||
formInitialData,
|
||||
}"
|
||||
:user-params="{ showEmpty: false }"
|
||||
:columns="columns"
|
||||
|
@ -260,7 +271,7 @@ const getDateColor = (date) => {
|
|||
:include="{ relation: 'addresses' }"
|
||||
v-model="data.clientFk"
|
||||
:label="t('module.customer')"
|
||||
@update:model-value="(id) => fetchClientAddress(id, data)"
|
||||
@update:model-value="(id) => onClientSelected(id, data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -285,7 +296,22 @@ const getDateColor = (date) => {
|
|||
@update:model-value="() => fetchAgencies(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItem
|
||||
v-bind="scope.itemProps"
|
||||
:class="{ disabled: !scope.opt.isActive }"
|
||||
>
|
||||
<QItemSection style="min-width: min-content" avatar>
|
||||
<QIcon
|
||||
v-if="
|
||||
scope.opt.isActive &&
|
||||
data.defaultAddressFk === scope.opt.id
|
||||
"
|
||||
size="sm"
|
||||
color="grey"
|
||||
name="star"
|
||||
class="fill-icon"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
:class="{
|
||||
|
@ -313,6 +339,7 @@ const getDateColor = (date) => {
|
|||
<VnInputDate
|
||||
v-model="data.landed"
|
||||
:label="t('module.landed')"
|
||||
data-cy="landedDate"
|
||||
@update:model-value="() => fetchAgencies(data)"
|
||||
/>
|
||||
<VnSelect
|
||||
|
|
|
@ -44,8 +44,7 @@ const exprBuilder = (param, value) => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
sort-by="name ASC"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
@on-fetch="(data) => (agencyList = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
<script setup>
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import CardList from 'components/ui/CardList.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
|
||||
import ShelvingSummary from 'pages/Shelving/Card/ShelvingSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
|
||||
import ShelvingSummary from './Card/ShelvingSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import exprBuilder from './ShelvingExprBuilder.js';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const dataKey = 'ShelvingList';
|
||||
|
@ -17,9 +20,56 @@ const filter = {
|
|||
include: [{ relation: 'parking' }],
|
||||
};
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/shelving/${id}` });
|
||||
}
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'code',
|
||||
label: t('globals.code'),
|
||||
isId: true,
|
||||
isTitle: true,
|
||||
columnFilter: false,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'parking',
|
||||
label: t('shelving.list.parking'),
|
||||
sortable: true,
|
||||
format: (val) => val?.code ?? '',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'priority',
|
||||
label: t('shelving.list.priority'),
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'isRecyclable',
|
||||
label: t('shelving.summary.recyclable'),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row.id, ShelvingSummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const onDataSaved = ({ id }) => {
|
||||
router.push({ name: 'ShelvingBasicData', params: { id } });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -37,48 +87,75 @@ function navigate(id) {
|
|||
<ShelvingFilter data-key="ShelvingList" />
|
||||
</template>
|
||||
<template #body>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate :data-key="dataKey">
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:id="row.id"
|
||||
:title="row.code"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
:label="$t('shelving.list.parking')"
|
||||
:title-label="$t('shelving.list.parking')"
|
||||
:value="row.parking?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="$t('shelving.list.priority')"
|
||||
:value="row?.priority"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="$t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id, ShelvingSummary)"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<RouterLink :to="{ name: 'ShelvingCreate' }">
|
||||
<QBtn fab icon="add" color="primary" v-shortcut="'+'" />
|
||||
<QTooltip>
|
||||
{{ $t('shelving.list.newShelving') }}
|
||||
</QTooltip>
|
||||
</RouterLink>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
<VnTable
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
is-editable="false"
|
||||
:right-search="false"
|
||||
:use-model="true"
|
||||
:disable-option="{ table: true }"
|
||||
redirect="shelving"
|
||||
default-mode="card"
|
||||
:create="{
|
||||
urlCreate: 'Shelvings',
|
||||
title: t('globals.pageTitles.shelvingCreate'),
|
||||
onDataSaved,
|
||||
formInitialData: {
|
||||
parkingFk: null,
|
||||
priority: null,
|
||||
code: '',
|
||||
isRecyclable: false,
|
||||
},
|
||||
}"
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnSelect
|
||||
v-model="data.parkingFk"
|
||||
url="Parkings"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:label="t('shelving.list.parking')"
|
||||
:filter-options="['id', 'code']"
|
||||
:fields="['id', 'code']"
|
||||
/>
|
||||
<VnCheckbox
|
||||
v-model="data.isRecyclable"
|
||||
:label="t('shelving.summary.recyclable')"
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 55%;
|
||||
}
|
||||
.list-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
shelving:
|
||||
list:
|
||||
parking: Estacionamiento
|
||||
priority: Prioridad
|
||||
|
||||
summary:
|
||||
recyclable: Reciclable
|
||||
en:
|
||||
shelving:
|
||||
list:
|
||||
parking: Parking
|
||||
priority: Priority
|
||||
|
||||
summary:
|
||||
recyclable: Recyclable
|
||||
</i18n>
|
||||
|
|
|
@ -11,6 +11,11 @@ export default {
|
|||
'isSerious',
|
||||
'isTrucker',
|
||||
'account',
|
||||
'workerFk',
|
||||
'note',
|
||||
'isReal',
|
||||
'isPayMethodChecked',
|
||||
'companySize',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
|
|
@ -108,7 +108,6 @@ function handleLocation(data, location) {
|
|||
<VnAccountNumber
|
||||
v-model="data.account"
|
||||
:label="t('supplier.fiscalData.account')"
|
||||
clearable
|
||||
data-cy="supplierFiscalDataAccount"
|
||||
insertable
|
||||
:maxlength="10"
|
||||
|
@ -185,8 +184,8 @@ function handleLocation(data, location) {
|
|||
/>
|
||||
<VnCheckbox
|
||||
v-model="data.isVies"
|
||||
:label="t('globals.isVies')"
|
||||
:info="t('whenActivatingIt')"
|
||||
:label="t('globals.isVies')"
|
||||
:info="t('whenActivatingIt')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
|||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import SupplierSummary from './Card/SupplierSummary.vue';
|
||||
|
@ -53,7 +52,7 @@ const columns = computed(() => [
|
|||
label: t('globals.alias'),
|
||||
name: 'alias',
|
||||
columnFilter: {
|
||||
name: 'search',
|
||||
name: 'nickname',
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
|
@ -120,6 +119,21 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const filterColumns = computed(() => {
|
||||
const copy = [...columns.value];
|
||||
copy.splice(copy.length - 1, 0, {
|
||||
align: 'left',
|
||||
label: t('globals.params.provinceFk'),
|
||||
name: 'provinceFk',
|
||||
options: provincesOptions.value,
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
},
|
||||
});
|
||||
|
||||
return copy;
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -130,7 +144,7 @@ const columns = computed(() => [
|
|||
/>
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
:columns="filterColumns"
|
||||
prefix="supplier"
|
||||
:array-data-props="{
|
||||
url: 'Suppliers/filter',
|
||||
|
@ -165,17 +179,6 @@ const columns = computed(() => [
|
|||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
<template #moreFilterPanel="{ params, searchFn }">
|
||||
<VnSelect
|
||||
:label="t('globals.params.provinceFk')"
|
||||
v-model="params.provinceFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="provincesOptions"
|
||||
filled
|
||||
dense
|
||||
class="q-px-sm q-pr-lg"
|
||||
/>
|
||||
</template>
|
||||
</VnSection>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ function ticketFilter(ticket) {
|
|||
<VnLv :label="t('globals.warehouse')" :value="entity.warehouse?.name" />
|
||||
<VnLv :label="t('globals.alias')" :value="entity.nickname" />
|
||||
</template>
|
||||
<template #icons>
|
||||
<template #icons="{ entity }">
|
||||
<QCardActions class="q-gutter-x-xs">
|
||||
<TicketProblems :row="problems" />
|
||||
<TicketProblems :row="{ ...entity?.client, ...problems }" />
|
||||
</QCardActions>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
|
|
|
@ -37,7 +37,6 @@ const expeditionStateTypes = ref([]);
|
|||
|
||||
const expeditionsFilter = computed(() => ({
|
||||
where: { ticketFk: route.params.id },
|
||||
order: ['created DESC'],
|
||||
}));
|
||||
|
||||
const ticketArrayData = useArrayData('Ticket');
|
||||
|
@ -325,6 +324,7 @@ onMounted(async () => {
|
|||
"
|
||||
:redirect="false"
|
||||
order="created DESC"
|
||||
:filter="expeditionsFilter"
|
||||
>
|
||||
<template #column-freightItemName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
|
|
@ -681,6 +681,17 @@ watch(
|
|||
:disabled-attr="isTicketEditable"
|
||||
>
|
||||
<template #column-statusIcons="{ row }">
|
||||
<QIcon
|
||||
v-if="row.saleGroupFk"
|
||||
name="inventory_2"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip class="no-pointer-events">
|
||||
{{ `saleGroup: ${row.saleGroupFk}` }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<TicketProblems :row="row" />
|
||||
</template>
|
||||
<template #body-cell-picture="{ row }">
|
||||
|
@ -740,7 +751,7 @@ watch(
|
|||
{{ row?.item?.subName.toUpperCase() }}
|
||||
</div>
|
||||
</div>
|
||||
<FetchedTags :item="row" :max-length="6" />
|
||||
<FetchedTags :item="row.item" :max-length="6" />
|
||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||
<VnInput
|
||||
v-model="row.concept"
|
||||
|
|
|
@ -48,7 +48,7 @@ const getGroupedStates = (data) => {
|
|||
/>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
:sort-by="['name ASC']"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
@on-fetch="(data) => (agencies = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
@ -256,8 +256,6 @@ const getGroupedStates = (data) => {
|
|||
v-model="params.agencyModeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="agencies"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, onBeforeMount, watch } from 'vue';
|
||||
import { computed, ref, onBeforeMount, watch, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
@ -51,10 +51,21 @@ const userParams = {
|
|||
onBeforeMount(() => {
|
||||
initializeFromQuery();
|
||||
stateStore.rightDrawer = true;
|
||||
if (!route.query.createForm) return;
|
||||
onClientSelected(JSON.parse(route.query.createForm));
|
||||
});
|
||||
onMounted(async () => {
|
||||
if (!route.query) return;
|
||||
if (route.query?.createForm) {
|
||||
formInitialData.value = JSON.parse(route.query?.createForm);
|
||||
await onClientSelected(formInitialData.value);
|
||||
} else if (route.query?.table) {
|
||||
const query = route.query?.table;
|
||||
const clientId = +JSON.parse(query)?.clientFk;
|
||||
if (clientId) await onClientSelected({ clientId });
|
||||
}
|
||||
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
|
||||
});
|
||||
const initializeFromQuery = () => {
|
||||
if (!route) return;
|
||||
const query = route.query.table ? JSON.parse(route.query.table) : {};
|
||||
from.value = query.from || from.toISOString();
|
||||
to.value = query.to || to.toISOString();
|
||||
|
@ -69,7 +80,6 @@ const companiesOptions = ref([]);
|
|||
const accountingOptions = ref([]);
|
||||
const amountToReturn = ref();
|
||||
const dataKey = 'TicketList';
|
||||
const filterPanelRef = ref(null);
|
||||
const formInitialData = ref({});
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -251,7 +261,32 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
const onClientSelected = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
await fetchAddresses(formData);
|
||||
};
|
||||
|
||||
const fetchAddresses = async (formData) => {
|
||||
const { data } = await getAddresses(formData.clientId);
|
||||
formInitialData.value = { clientId: formData.clientId };
|
||||
if (!data) return;
|
||||
addressesOptions.value = data;
|
||||
selectedClient.value = data[0].client;
|
||||
formData.addressId = selectedClient.value.defaultAddressFk;
|
||||
formInitialData.value.addressId = formData.addressId;
|
||||
};
|
||||
watch(
|
||||
() => route.query.table,
|
||||
async (newValue) => {
|
||||
if (newValue) {
|
||||
const clientId = +JSON.parse(newValue)?.clientFk;
|
||||
if (clientId) await onClientSelected({ clientId });
|
||||
if (tableRef.value)
|
||||
tableRef.value.create.formInitialData = formInitialData.value;
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
function resetAgenciesSelector(formData) {
|
||||
agenciesOptions.value = [];
|
||||
if (formData) formData.agencyModeId = null;
|
||||
|
@ -262,12 +297,6 @@ function redirectToLines(id) {
|
|||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
const onClientSelected = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
await fetchClient(formData);
|
||||
await fetchAddresses(formData);
|
||||
};
|
||||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
const response = await getAgencies(formData, selectedClient.value);
|
||||
|
@ -278,22 +307,6 @@ const fetchAvailableAgencies = async (formData) => {
|
|||
if (agency) formData.agencyModeId = agency.agencyModeFk;
|
||||
};
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
const response = await getClient(formData.clientId);
|
||||
if (!response) return;
|
||||
const [client] = response.data;
|
||||
selectedClient.value = client;
|
||||
};
|
||||
|
||||
const fetchAddresses = async (formData) => {
|
||||
const response = await getAddresses(formData.clientId);
|
||||
if (!response) return;
|
||||
addressesOptions.value = response.data;
|
||||
|
||||
const { defaultAddress } = selectedClient.value;
|
||||
formData.addressId = defaultAddress.id;
|
||||
};
|
||||
|
||||
const getColor = (row) => {
|
||||
if (row.alertLevelCode === 'OK') return 'bg-success';
|
||||
else if (row.alertLevelCode === 'FREE') return 'bg-notice';
|
||||
|
@ -445,22 +458,6 @@ function setReference(data) {
|
|||
|
||||
dialogData.value.value.description = newDescription;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => route.query.table,
|
||||
(newValue) => {
|
||||
if (newValue) {
|
||||
const clientId = +JSON.parse(newValue)?.clientFk;
|
||||
if (!clientId) return;
|
||||
formInitialData.value = {
|
||||
clientId,
|
||||
};
|
||||
if (tableRef.value) tableRef.value.create.formInitialData = { clientId };
|
||||
onClientSelected({ clientId });
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -73,6 +73,7 @@ warehouses();
|
|||
/>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -39,6 +39,7 @@ const redirectToTravelBasicData = (_, { id }) => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -52,9 +52,8 @@ defineExpose({ states });
|
|||
v-model="params.agencyModeFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="agencyModes"
|
||||
sort-by="name ASC"
|
||||
:use-like="false"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
option-filter="name"
|
||||
dense
|
||||
outlined
|
||||
|
|
|
@ -343,19 +343,29 @@ const updateData = async () => {
|
|||
|
||||
const getMailStates = async (date) => {
|
||||
const url = `WorkerTimeControls/${route.params.id}/getMailStates`;
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const prevMonth = month == 1 ? 12 : month - 1;
|
||||
const params = {
|
||||
month,
|
||||
year: date.getFullYear(),
|
||||
|
||||
const getMonthStates = async (month, year) => {
|
||||
return (await axios.get(url, { params: { month, year } })).data;
|
||||
};
|
||||
|
||||
const curMonthStates = (await axios.get(url, { params })).data;
|
||||
const prevMonthStates = (
|
||||
await axios.get(url, { params: { ...params, month: prevMonth } })
|
||||
).data;
|
||||
const curMonthStates = await getMonthStates(month, year);
|
||||
|
||||
workerTimeControlMails.value = curMonthStates.concat(prevMonthStates);
|
||||
const prevMonthStates = await getMonthStates(
|
||||
month === 1 ? 12 : month - 1,
|
||||
month === 1 ? year - 1 : year,
|
||||
);
|
||||
|
||||
const postMonthStates = await getMonthStates(
|
||||
month === 12 ? 1 : month + 1,
|
||||
month === 12 ? year + 1 : year,
|
||||
);
|
||||
workerTimeControlMails.value = [
|
||||
...curMonthStates,
|
||||
...prevMonthStates,
|
||||
...postMonthStates,
|
||||
];
|
||||
};
|
||||
|
||||
const showWorkerTimeForm = (propValue, formType) => {
|
||||
|
|
|
@ -9,22 +9,22 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
|
|||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const validAddresses = ref([]);
|
||||
const addresses = ref([]);
|
||||
|
||||
const setFilteredAddresses = (data) => {
|
||||
const validIds = new Set(validAddresses.value.map((item) => item.addressFk));
|
||||
addresses.value = data.filter((address) => validIds.has(address.id));
|
||||
addresses.value = data.map(({ address }) => address);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="RoadmapAddresses"
|
||||
:filter="{
|
||||
include: { relation: 'address' },
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (validAddresses = data)"
|
||||
@on-fetch="setFilteredAddresses"
|
||||
/>
|
||||
<FetchData url="Addresses" auto-load @on-fetch="setFilteredAddresses" />
|
||||
<FormModel auto-load model="Zone">
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
|
@ -120,12 +120,10 @@ const setFilteredAddresses = (data) => {
|
|||
option-label="nickname"
|
||||
:options="addresses"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="id"
|
||||
sort-by="nickname ASC"
|
||||
hide-selected
|
||||
map-options
|
||||
:rules="validate('data.addressFk')"
|
||||
:filter-options="['id']"
|
||||
:where="filterWhere"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
|
|
@ -5,6 +5,7 @@ import VnInput from 'components/common/VnInput.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import order from 'src/router/modules/order';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -24,7 +25,7 @@ const agencies = ref([]);
|
|||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||
@on-fetch="(data) => (agencies = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -199,9 +199,8 @@ function formatRow(row) {
|
|||
<template #more-create-dialog="{ data }">
|
||||
<VnSelect
|
||||
url="AgencyModes"
|
||||
sort-by="name ASC"
|
||||
v-model="data.agencyModeFk"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:label="t('list.agency')"
|
||||
/>
|
||||
<VnInput
|
||||
|
|
|
@ -111,15 +111,6 @@ export default {
|
|||
shelvingCard,
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'ShelvingCreate',
|
||||
meta: {
|
||||
title: 'shelvingCreate',
|
||||
icon: 'add',
|
||||
},
|
||||
component: () => import('src/pages/Shelving/Card/ShelvingForm.vue'),
|
||||
},
|
||||
{
|
||||
path: 'parking',
|
||||
name: 'ParkingMain',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="cypress" />
|
||||
// redmine.verdnatura.es/issues/8417
|
||||
describe.skip('ClaimPhoto', () => {
|
||||
describe('ClaimPhoto', () => {
|
||||
const carrouselClose = '.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon';
|
||||
beforeEach(() => {
|
||||
const claimId = 1;
|
||||
cy.login('developer');
|
||||
|
@ -16,6 +16,7 @@ describe.skip('ClaimPhoto', () => {
|
|||
});
|
||||
|
||||
it('should add new file with drag and drop', () => {
|
||||
cy.get('.container').should('be.visible').and('exist');
|
||||
cy.get('.container').selectFile('test/cypress/fixtures/image.jpg', {
|
||||
action: 'drag-drop',
|
||||
});
|
||||
|
@ -23,33 +24,23 @@ describe.skip('ClaimPhoto', () => {
|
|||
});
|
||||
|
||||
it('should open first image dialog change to second and close', () => {
|
||||
cy.get(':nth-last-child(1) > .q-card').click();
|
||||
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
|
||||
'be.visible',
|
||||
);
|
||||
cy.dataCy('file-1').click();
|
||||
cy.get(carrouselClose).click();
|
||||
|
||||
cy.get('.q-carousel__control > button').click();
|
||||
|
||||
cy.get(
|
||||
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon',
|
||||
).click();
|
||||
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
|
||||
'not.be.visible',
|
||||
);
|
||||
cy.dataCy('file-1').click();
|
||||
cy.get('.q-carousel__control > button').as('nextButton').click();
|
||||
cy.get('.q-carousel__slide > .q-ma-none').should('be.visible');
|
||||
cy.get(carrouselClose).click();
|
||||
});
|
||||
|
||||
it('should remove third and fourth file', () => {
|
||||
cy.get(
|
||||
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon',
|
||||
).click();
|
||||
cy.dataCy('delete-button-4').click();
|
||||
cy.get(
|
||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
|
||||
).click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
||||
|
||||
cy.get(
|
||||
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon',
|
||||
).click();
|
||||
cy.dataCy('delete-button-3').click();
|
||||
cy.get(
|
||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
|
||||
).click();
|
||||
|
|
|
@ -17,7 +17,6 @@ describe('InvoiceOut summary', () => {
|
|||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-out/1/summary`);
|
||||
});
|
||||
|
||||
it('open the descriptors', () => {
|
||||
cy.get(firstRowDescriptors(1)).click();
|
||||
cy.get('.descriptor').should('be.visible');
|
||||
|
@ -35,7 +34,6 @@ describe('InvoiceOut summary', () => {
|
|||
|
||||
it('should open the ticket list', () => {
|
||||
cy.get(toTicketList).click();
|
||||
cy.get('.descriptor').should('be.visible');
|
||||
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
|
||||
});
|
||||
|
||||
|
|
|
@ -3,23 +3,22 @@ describe('ItemBarcodes', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/list`);
|
||||
cy.typeSearchbar('1{enter}');
|
||||
cy.visit(`/#/item/1/barcode`);
|
||||
});
|
||||
|
||||
it('should throw an error if the barcode exists', () => {
|
||||
cy.get('[href="#/item/1/barcode"]').click();
|
||||
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.dataCy('Code_input').eq(3).type('1111111111');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
newBarcode('1111111111');
|
||||
cy.checkNotification('Codes can not be repeated');
|
||||
});
|
||||
|
||||
it('should create a new barcode', () => {
|
||||
cy.get('[href="#/item/1/barcode"]').click();
|
||||
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.dataCy('Code_input').eq(3).type('1231231231');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
newBarcode('1231231231');
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
|
||||
function newBarcode(text) {
|
||||
cy.dataCy('addBarcode_input').click();
|
||||
cy.dataCy('Code_input').eq(3).should('exist').type(text);
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('OrderList', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 1080);
|
||||
cy.visit('/#/order/list');
|
||||
});
|
||||
|
||||
it('create order', () => {
|
||||
/* ==== Generated with Cypress Studio ==== */
|
||||
cy.get('[data-cy="vnTableCreateBtn"]').click();
|
||||
cy.get('[data-cy="Client_select"]').type('1101');
|
||||
cy.get('.q-menu').contains('Bruce Wayne').click();
|
||||
cy.get('[data-cy="Address_select"]').click();
|
||||
cy.get(
|
||||
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
|
||||
).should('have.text', 'star');
|
||||
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
|
||||
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
||||
cy.get('.q-card [data-cy="Agency_select"]').click();
|
||||
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
|
||||
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
|
||||
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
|
||||
cy.wait('@orderSale');
|
||||
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
|
||||
const id = text.text().trim().split('#')[1];
|
||||
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
|
||||
});
|
||||
cy.url().should('include', `/order`);
|
||||
});
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('ParkingList', () => {
|
||||
const searchbar = '#searchbar input';
|
||||
const firstCard = ':nth-child(1) > .q-card > .no-margin > .q-py-none';
|
||||
const firstCard = ':nth-child(1) > .q-card > .no-margin > .q-py-none';
|
||||
const summaryHeader = '.summaryBody .header';
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('ShelvingList', () => {
|
||||
const parking =
|
||||
'.q-card > :nth-child(1) > .q-select > .q-field__inner > .q-field__control > .q-field__control-container';
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/shelving/1/basic-data`);
|
||||
});
|
||||
|
||||
it('should give an error if the code aldready exists', () => {
|
||||
cy.dataCy('Code_input').should('exist').clear().type('AA7');
|
||||
cy.saveCard();
|
||||
cy.get('.q-notification__message').should('have.text', 'The code already exists');
|
||||
});
|
||||
it('should edit the data and save', () => {
|
||||
cy.selectOption(parking, 'P-01-1');
|
||||
cy.dataCy('Code_input').clear().type('AA1');
|
||||
cy.dataCy('Priority_input').clear().type('10');
|
||||
cy.get(':nth-child(2) > .q-checkbox > .q-checkbox__inner').click();
|
||||
cy.saveCard();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,41 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('ShelvingList', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/shelving/list`);
|
||||
});
|
||||
|
||||
it('should redirect on clicking a shelving', () => {
|
||||
cy.typeSearchbar('{enter}');
|
||||
cy.dataCy('cardBtn').eq(0).click();
|
||||
cy.get('.summaryHeader > .header > .q-icon').click();
|
||||
cy.url().should('include', '/shelving/1/summary');
|
||||
});
|
||||
|
||||
it('should redirect from preview to basic-data', () => {
|
||||
cy.typeSearchbar('{enter}');
|
||||
cy.dataCy('cardBtn').eq(0).click();
|
||||
cy.get('.q-card > .header').click();
|
||||
cy.url().should('include', '/shelving/1/basic-data');
|
||||
});
|
||||
|
||||
it('should filter and redirect if only one result', () => {
|
||||
cy.selectOption('[data-cy="Parking_select"]', 'P-02-2');
|
||||
cy.dataCy('Parking_select').type('{enter}');
|
||||
cy.url().should('match', /\/shelving\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should create a new shelving', () => {
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.dataCy('code-create-popup').type('Test');
|
||||
cy.dataCy('Priority_input').type('10');
|
||||
cy.selectOption(
|
||||
'.grid-create > .q-select > .q-field__inner > .q-field__control > .q-field__control-container',
|
||||
'100-01',
|
||||
);
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('Data created');
|
||||
cy.url().should('match', /\/shelving\/\d+\/basic-data/);
|
||||
});
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('TicketList', () => {
|
||||
describe.only('TicketList', () => {
|
||||
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -68,7 +68,7 @@ describe('TicketList', () => {
|
|||
cy.url().should('match', /\/ticket\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should show the corerct problems', () => {
|
||||
it('should show the correct problems', () => {
|
||||
cy.intercept('GET', '**/api/Tickets/filter*', (req) => {
|
||||
req.headers['cache-control'] = 'no-cache';
|
||||
req.headers['pragma'] = 'no-cache';
|
||||
|
|
|
@ -182,14 +182,17 @@ describe('TicketSale', () => {
|
|||
it('change quantity ', () => {
|
||||
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||
cy.waitForElement(firstRow);
|
||||
cy.dataCy('ticketSaleQuantityInput').clear();
|
||||
cy.dataCy('ticketSaleQuantityInput').type(quantity).trigger('tab');
|
||||
cy.dataCy('ticketSaleQuantityInput').find('input').clear();
|
||||
cy.dataCy('ticketSaleQuantityInput')
|
||||
.find('input')
|
||||
.type(quantity)
|
||||
.trigger('tab');
|
||||
cy.get('.q-page > :nth-child(6)').click();
|
||||
|
||||
handleVnConfirm();
|
||||
|
||||
cy.get('[data-cy="ticketSaleQuantityInput"]')
|
||||
.find('[data-cy="undefined_input"]')
|
||||
.find('input')
|
||||
.should('have.value', `${quantity}`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,35 +1,37 @@
|
|||
describe('VnInput Component', () => {
|
||||
describe('VnAccountNumber', () => {
|
||||
const accountInput = 'input[data-cy="supplierFiscalDataAccount_input"]';
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 1080);
|
||||
cy.visit('/#/supplier/1/fiscal-data');
|
||||
});
|
||||
|
||||
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');
|
||||
describe('VnInput handleInsertMode()', () => {
|
||||
it('should replace character at cursor position in insert mode', () => {
|
||||
cy.get(accountInput).type('{selectall}4100000001');
|
||||
cy.get(accountInput).type('{movetostart}');
|
||||
cy.get(accountInput).type('999');
|
||||
cy.get(accountInput).should('have.value', '9990000001');
|
||||
});
|
||||
|
||||
it('should replace character at cursor position in insert mode', () => {
|
||||
cy.get(accountInput).clear();
|
||||
cy.get(accountInput).type('4100000001');
|
||||
cy.get(accountInput).type('{movetostart}');
|
||||
cy.get(accountInput).type('999');
|
||||
cy.get(accountInput).should('have.value', '9990000001');
|
||||
});
|
||||
|
||||
it('should respect maxlength prop', () => {
|
||||
cy.get(accountInput).clear();
|
||||
cy.get(accountInput).type('123456789012345');
|
||||
cy.get(accountInput).should('have.value', '1234567890');
|
||||
});
|
||||
});
|
||||
|
||||
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
|
||||
it('should convert short account number to standard format', () => {
|
||||
cy.get(accountInput).clear();
|
||||
cy.get(accountInput).type('123.');
|
||||
cy.get(accountInput).should('have.value', '1230000000');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue