Merge branch 'dev' of https: refs #8581//gitea.verdnatura.es/verdnatura/salix-front into 8581-invoiceinE2e
This commit is contained in:
commit
5c0f519073
|
@ -115,6 +115,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh 'rm -f junit/e2e-*.xml'
|
sh 'rm -f junit/e2e-*.xml'
|
||||||
|
sh 'rm -rf test/cypress/screenshots'
|
||||||
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
|
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
|
||||||
|
|
||||||
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||||
|
@ -132,6 +133,7 @@ pipeline {
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
|
sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
|
||||||
|
archiveArtifacts artifacts: 'test/cypress/screenshots/**/*', allowEmptyArchive: true
|
||||||
junit(
|
junit(
|
||||||
testResults: 'junit/e2e-*.xml',
|
testResults: 'junit/e2e-*.xml',
|
||||||
allowEmptyResults: true
|
allowEmptyResults: true
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { useColor } from 'src/composables/useColor';
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
import { useCapitalize } from 'src/composables/useCapitalize';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import VnAvatar from '../ui/VnAvatar.vue';
|
import VnAvatar from '../ui/VnAvatar.vue';
|
||||||
import VnJsonValue from '../common/VnJsonValue.vue';
|
import VnLogValue from './VnLogValue.vue';
|
||||||
import FetchData from '../FetchData.vue';
|
import FetchData from '../FetchData.vue';
|
||||||
import VnSelect from './VnSelect.vue';
|
import VnSelect from './VnSelect.vue';
|
||||||
import VnUserLink from '../ui/VnUserLink.vue';
|
import VnUserLink from '../ui/VnUserLink.vue';
|
||||||
|
@ -560,10 +560,11 @@ watch(
|
||||||
value.nameI18n
|
value.nameI18n
|
||||||
}}:
|
}}:
|
||||||
</span>
|
</span>
|
||||||
<VnJsonValue
|
<VnLogValue
|
||||||
:value="
|
:value="
|
||||||
value.val.val
|
value.val.val
|
||||||
"
|
"
|
||||||
|
:name="value.name"
|
||||||
/>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
@ -614,7 +615,11 @@ watch(
|
||||||
>
|
>
|
||||||
{{ prop.nameI18n }}:
|
{{ prop.nameI18n }}:
|
||||||
</span>
|
</span>
|
||||||
<VnJsonValue :value="prop.val.val" />
|
<VnLogValue
|
||||||
|
:value="prop.val.val"
|
||||||
|
:name="prop.name"
|
||||||
|
/>
|
||||||
|
<VnIconLink />
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
propIndex <
|
propIndex <
|
||||||
|
@ -642,8 +647,9 @@ watch(
|
||||||
{{ prop.nameI18n }}:
|
{{ prop.nameI18n }}:
|
||||||
</span>
|
</span>
|
||||||
<span v-if="log.action == 'update'">
|
<span v-if="log.action == 'update'">
|
||||||
<VnJsonValue
|
<VnLogValue
|
||||||
:value="prop.old.val"
|
:value="prop.old.val"
|
||||||
|
:name="prop.name"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="prop.old.id"
|
v-if="prop.old.id"
|
||||||
|
@ -652,8 +658,9 @@ watch(
|
||||||
#{{ prop.old.id }}
|
#{{ prop.old.id }}
|
||||||
</span>
|
</span>
|
||||||
→
|
→
|
||||||
<VnJsonValue
|
<VnLogValue
|
||||||
:value="prop.val.val"
|
:value="prop.val.val"
|
||||||
|
:name="prop.name"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="prop.val.id"
|
v-if="prop.val.id"
|
||||||
|
@ -663,8 +670,9 @@ watch(
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-else="prop.old.val">
|
<span v-else="prop.old.val">
|
||||||
<VnJsonValue
|
<VnLogValue
|
||||||
:value="prop.val.val"
|
:value="prop.val.val"
|
||||||
|
:name="prop.name"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="prop.old.id"
|
v-if="prop.old.id"
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<script setup>
|
||||||
|
import { useDescriptorStore } from 'src/stores/useDescriptorStore';
|
||||||
|
import VnJsonValue from './VnJsonValue.vue';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
const descriptorStore = useDescriptorStore();
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
name: { type: [String], default: undefined },
|
||||||
|
});
|
||||||
|
|
||||||
|
const descriptor = computed(() => descriptorStore.has($props.name));
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnJsonValue v-bind="$attrs" />
|
||||||
|
<QIcon
|
||||||
|
name="launch"
|
||||||
|
class="link"
|
||||||
|
v-if="$attrs.value && descriptor"
|
||||||
|
:data-cy="'iconLaunch-' + $props.name"
|
||||||
|
/>
|
||||||
|
<component :is="descriptor" :id="$attrs.value" v-if="$attrs.value && descriptor" />
|
||||||
|
</template>
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import VnLogValue from 'src/components/common/VnLogValue.vue';
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
|
||||||
|
const buildComponent = (props) => {
|
||||||
|
return createWrapper(VnLogValue, {
|
||||||
|
props,
|
||||||
|
global: {},
|
||||||
|
}).wrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('VnLogValue', () => {
|
||||||
|
const id = 1;
|
||||||
|
it('renders without descriptor', async () => {
|
||||||
|
expect(getIcon('inventFk').exists()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders with descriptor', async () => {
|
||||||
|
expect(getIcon('claimFk').text()).toBe('launch');
|
||||||
|
});
|
||||||
|
|
||||||
|
function getIcon(name) {
|
||||||
|
const wrapper = buildComponent({ value: { val: id }, name });
|
||||||
|
return wrapper.find('.q-icon');
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
<script setup>
|
||||||
|
import AccountDescriptor from './AccountDescriptor.vue';
|
||||||
|
import AccountSummary from './AccountSummary.vue';
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QPopupProxy style="max-width: 10px">
|
||||||
|
<AccountDescriptor
|
||||||
|
v-if="$attrs.id"
|
||||||
|
v-bind="$attrs.id"
|
||||||
|
:summary="AccountSummary"
|
||||||
|
:proxy-render="true"
|
||||||
|
/>
|
||||||
|
</QPopupProxy>
|
||||||
|
</template>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<script setup>
|
||||||
|
import ClaimDescriptor from './ClaimDescriptor.vue';
|
||||||
|
import ClaimSummary from './ClaimSummary.vue';
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QPopupProxy style="max-width: 10px">
|
||||||
|
<ClaimDescriptor
|
||||||
|
v-if="$attrs.id"
|
||||||
|
v-bind="$attrs.id"
|
||||||
|
:summary="ClaimSummary"
|
||||||
|
:proxy-render="true"
|
||||||
|
/>
|
||||||
|
</QPopupProxy>
|
||||||
|
</template>
|
|
@ -32,7 +32,7 @@ onMounted(() => {
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.ticket,
|
() => props.ticket,
|
||||||
() => restoreTicket
|
() => restoreTicket,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { push, currentRoute } = useRouter();
|
const { push, currentRoute } = useRouter();
|
||||||
|
@ -58,7 +58,7 @@ const hasDocuwareFile = ref();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const canRestoreTicket = ref(false);
|
const canRestoreTicket = ref(false);
|
||||||
|
|
||||||
const onClientSelected = async(clientId) =>{
|
const onClientSelected = async (clientId) => {
|
||||||
client.value = clientId;
|
client.value = clientId;
|
||||||
await fetchClient();
|
await fetchClient();
|
||||||
await fetchAddresses();
|
await fetchAddresses();
|
||||||
|
@ -66,10 +66,10 @@ const onClientSelected = async(clientId) =>{
|
||||||
|
|
||||||
const onAddressSelected = (addressId) => {
|
const onAddressSelected = (addressId) => {
|
||||||
address.value = addressId;
|
address.value = addressId;
|
||||||
}
|
};
|
||||||
|
|
||||||
const fetchClient = async () => {
|
const fetchClient = async () => {
|
||||||
const response = await getClient(client.value)
|
const response = await getClient(client.value);
|
||||||
if (!response) return;
|
if (!response) return;
|
||||||
const [retrievedClient] = response.data;
|
const [retrievedClient] = response.data;
|
||||||
selectedClient.value = retrievedClient;
|
selectedClient.value = retrievedClient;
|
||||||
|
@ -151,7 +151,7 @@ function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
|
||||||
recipientId: ticket.value.clientFk,
|
recipientId: ticket.value.clientFk,
|
||||||
type: type,
|
type: type,
|
||||||
},
|
},
|
||||||
'_blank'
|
'_blank',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +297,8 @@ async function transferClient() {
|
||||||
clientFk: client.value,
|
clientFk: client.value,
|
||||||
addressFk: address.value,
|
addressFk: address.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
await axios.patch( `Tickets/${ticketId.value}/transferClient`, params );
|
await axios.patch(`Tickets/${ticketId.value}/transferClient`, params);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ async function changeShippedHour(time) {
|
||||||
|
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(
|
||||||
`Tickets/${ticketId.value}/updateEditableTicket`,
|
`Tickets/${ticketId.value}/updateEditableTicket`,
|
||||||
params
|
params,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (data) window.location.reload();
|
if (data) window.location.reload();
|
||||||
|
@ -405,8 +405,7 @@ async function uploadDocuware(force) {
|
||||||
uploadDocuware(true);
|
uploadDocuware(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data } = await axios.post(`Docuwares/upload`, {
|
const { data } = await axios.post(`Docuwares/upload-delivery-note`, {
|
||||||
fileCabinet: 'deliveryNote',
|
|
||||||
ticketIds: [parseInt(ticketId.value)],
|
ticketIds: [parseInt(ticketId.value)],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -500,7 +499,7 @@ async function ticketToRestore() {
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:disable="!client"
|
:disable="!client"
|
||||||
:options="addressesOptions"
|
:options="addressesOptions"
|
||||||
:fields="['id', 'nickname']"
|
:fields="['id', 'nickname']"
|
||||||
|
@ -815,7 +814,7 @@ async function ticketToRestore() {
|
||||||
en:
|
en:
|
||||||
addTurn: Add turn
|
addTurn: Add turn
|
||||||
invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
|
invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
|
||||||
|
|
||||||
es:
|
es:
|
||||||
Show Delivery Note...: Ver albarán...
|
Show Delivery Note...: Ver albarán...
|
||||||
Send Delivery Note...: Enviar albarán...
|
Send Delivery Note...: Enviar albarán...
|
||||||
|
|
|
@ -340,25 +340,20 @@ async function makeInvoice(ticket) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendDocuware(ticket) {
|
async function sendDocuware(tickets) {
|
||||||
try {
|
let ticketIds = tickets.map((item) => item.id);
|
||||||
let ticketIds = ticket.map((item) => item.id);
|
|
||||||
|
|
||||||
const { data } = await axios.post(`Docuwares/upload`, {
|
const { data } = await axios.post(`Docuwares/upload-delivery-note`, {
|
||||||
fileCabinet: 'deliveryNote',
|
ticketIds,
|
||||||
ticketIds,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
for (let ticket of ticketIds) {
|
for (let ticket of tickets) {
|
||||||
ticket.stateFk = data.id;
|
ticket.stateFk = data.id;
|
||||||
ticket.state = data.name;
|
ticket.state = data.name;
|
||||||
ticket.alertLevel = data.alertLevel;
|
ticket.alertLevel = data.alertLevel;
|
||||||
ticket.alertLevelCode = data.code;
|
ticket.alertLevelCode = data.code;
|
||||||
}
|
|
||||||
notify('globals.dataSaved', 'positive');
|
|
||||||
} catch (err) {
|
|
||||||
console.err('err: ', err);
|
|
||||||
}
|
}
|
||||||
|
notify('globals.dataSaved', 'positive');
|
||||||
}
|
}
|
||||||
|
|
||||||
function openBalanceDialog(ticket) {
|
function openBalanceDialog(ticket) {
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, reactive } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import axios from 'axios';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormPopup from 'components/FormPopup.vue';
|
import FormPopup from 'components/FormPopup.vue';
|
||||||
import ZoneLocationsTree from './ZoneLocationsTree.vue';
|
import ZoneLocationsTree from './ZoneLocationsTree.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import axios from 'axios';
|
import { toDateFormat } from 'src/filters/date';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
date: {
|
date: {
|
||||||
|
@ -34,18 +36,25 @@ const props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
isMasiveEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
zoneIds: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['onSubmit', 'closeForm']);
|
const emit = defineEmits(['onSubmit', 'closeForm']);
|
||||||
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
const isNew = computed(() => props.isNewMode);
|
const isNew = computed(() => props.isNewMode);
|
||||||
const dated = reactive(props.date);
|
const dated = ref(props.date || Date.vnNew());
|
||||||
const tickedNodes = ref();
|
const tickedNodes = ref();
|
||||||
|
|
||||||
const _excludeType = ref('all');
|
const _excludeType = ref('all');
|
||||||
const excludeType = computed({
|
const excludeType = computed({
|
||||||
get: () => _excludeType.value,
|
get: () => _excludeType.value,
|
||||||
|
@ -63,16 +72,46 @@ const exclusionGeoCreate = async () => {
|
||||||
geoIds: tickedNodes.value,
|
geoIds: tickedNodes.value,
|
||||||
};
|
};
|
||||||
await axios.post('Zones/exclusionGeo', params);
|
await axios.post('Zones/exclusionGeo', params);
|
||||||
|
quasar.notify({
|
||||||
|
message: t('globals.dataSaved'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
const exclusionCreate = async () => {
|
const exclusionCreate = async () => {
|
||||||
const url = `Zones/${route.params.id}/exclusions`;
|
const defaultMonths = await axios.get('ZoneConfigs');
|
||||||
|
const nMonths = defaultMonths.data[0].defaultMonths;
|
||||||
const body = {
|
const body = {
|
||||||
dated,
|
dated: dated.value,
|
||||||
};
|
};
|
||||||
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
|
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
||||||
else await axios.put(`${url}/${props.event?.id}`, body);
|
for (const id of zoneIds) {
|
||||||
|
const url = `Zones/${id}/exclusions`;
|
||||||
|
let today = moment(dated.value);
|
||||||
|
let lastDay = today.clone().add(nMonths, 'months').endOf('month');
|
||||||
|
|
||||||
|
const { data } = await axios.get(`Zones/getEventsFiltered`, {
|
||||||
|
params: {
|
||||||
|
zoneFk: id,
|
||||||
|
started: today,
|
||||||
|
ended: lastDay,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const existsEvent = data.events.find(
|
||||||
|
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
|
||||||
|
);
|
||||||
|
if (existsEvent) {
|
||||||
|
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
|
||||||
|
else await axios.put(`${url}/${props.event?.id}`, body);
|
||||||
|
}
|
||||||
|
quasar.notify({
|
||||||
|
message: t('globals.dataSaved'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,6 +168,7 @@ onMounted(() => {
|
||||||
:label="t('eventsExclusionForm.all')"
|
:label="t('eventsExclusionForm.all')"
|
||||||
/>
|
/>
|
||||||
<QRadio
|
<QRadio
|
||||||
|
v-if="!props.isMasiveEdit"
|
||||||
v-model="excludeType"
|
v-model="excludeType"
|
||||||
dense
|
dense
|
||||||
val="specificLocations"
|
val="specificLocations"
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import axios from 'axios';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||||
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormPopup from 'components/FormPopup.vue';
|
import FormPopup from 'components/FormPopup.vue';
|
||||||
|
@ -9,11 +16,7 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnWeekdayPicker from 'src/components/common/VnWeekdayPicker.vue';
|
import VnWeekdayPicker from 'src/components/common/VnWeekdayPicker.vue';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import { toDateFormat } from 'src/filters/date';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
date: {
|
date: {
|
||||||
|
@ -32,6 +35,14 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
isMasiveEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
zoneIds: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['onSubmit', 'closeForm']);
|
const emit = defineEmits(['onSubmit', 'closeForm']);
|
||||||
|
@ -40,10 +51,10 @@ const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const weekdayStore = useWeekdayStore();
|
const weekdayStore = useWeekdayStore();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const quasar = useQuasar();
|
||||||
const isNew = computed(() => props.isNewMode);
|
const isNew = computed(() => props.isNewMode);
|
||||||
const eventInclusionFormData = ref({ wdays: [] });
|
const eventInclusionFormData = ref({ wdays: [] });
|
||||||
|
const dated = ref(props.date || Date.vnNew());
|
||||||
const _inclusionType = ref('indefinitely');
|
const _inclusionType = ref('indefinitely');
|
||||||
const inclusionType = computed({
|
const inclusionType = computed({
|
||||||
get: () => _inclusionType.value,
|
get: () => _inclusionType.value,
|
||||||
|
@ -56,8 +67,12 @@ const inclusionType = computed({
|
||||||
const arrayData = useArrayData('ZoneEvents');
|
const arrayData = useArrayData('ZoneEvents');
|
||||||
|
|
||||||
const createEvent = async () => {
|
const createEvent = async () => {
|
||||||
|
const defaultMonths = await axios.get('ZoneConfigs');
|
||||||
|
const nMonths = defaultMonths.data[0].defaultMonths;
|
||||||
|
|
||||||
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
|
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
|
||||||
eventInclusionFormData.value.wdays,
|
eventInclusionFormData.value.wdays,
|
||||||
|
eventInclusionFormData.value.wdays,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
|
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
|
||||||
|
@ -68,14 +83,43 @@ const createEvent = async () => {
|
||||||
eventInclusionFormData.value.ended = null;
|
eventInclusionFormData.value.ended = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNew.value)
|
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
||||||
await axios.post(`Zones/${route.params.id}/events`, eventInclusionFormData.value);
|
for (const id of zoneIds) {
|
||||||
else
|
let today = eventInclusionFormData.value.dated
|
||||||
await axios.put(
|
? moment(eventInclusionFormData.value.dated)
|
||||||
`Zones/${route.params.id}/events/${props.event?.id}`,
|
: moment(dated.value);
|
||||||
eventInclusionFormData.value,
|
let lastDay = today.clone().add(nMonths, 'months').endOf('month');
|
||||||
);
|
|
||||||
|
|
||||||
|
const { data } = await axios.get(`Zones/getEventsFiltered`, {
|
||||||
|
params: {
|
||||||
|
zoneFk: id,
|
||||||
|
started: today,
|
||||||
|
ended: lastDay,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const existsExclusion = data.exclusions.find(
|
||||||
|
(exclusion) =>
|
||||||
|
toDateFormat(exclusion.dated) ===
|
||||||
|
toDateFormat(eventInclusionFormData.value.dated),
|
||||||
|
);
|
||||||
|
if (existsExclusion) {
|
||||||
|
await axios.delete(
|
||||||
|
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNew.value)
|
||||||
|
await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
|
||||||
|
else
|
||||||
|
await axios.put(
|
||||||
|
`Zones/${id}/events/${props.event?.id}`,
|
||||||
|
eventInclusionFormData.value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
quasar.notify({
|
||||||
|
message: t('globals.dataSaved'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
emit('onSubmit');
|
emit('onSubmit');
|
||||||
};
|
};
|
||||||
|
@ -97,9 +141,11 @@ const refetchEvents = async () => {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.event) {
|
if (props.event) {
|
||||||
|
dated.value = props.event?.dated;
|
||||||
eventInclusionFormData.value = { ...props.event };
|
eventInclusionFormData.value = { ...props.event };
|
||||||
inclusionType.value = props.event?.type || 'day';
|
inclusionType.value = props.event?.type || 'day';
|
||||||
} else if (props.date) {
|
} else if (props.date) {
|
||||||
|
dated.value = props.date;
|
||||||
eventInclusionFormData.value.dated = props.date;
|
eventInclusionFormData.value.dated = props.date;
|
||||||
inclusionType.value = 'day';
|
inclusionType.value = 'day';
|
||||||
} else inclusionType.value = 'indefinitely';
|
} else inclusionType.value = 'indefinitely';
|
||||||
|
@ -125,6 +171,7 @@ onMounted(() => {
|
||||||
data-cy="ZoneEventInclusionDayRadio"
|
data-cy="ZoneEventInclusionDayRadio"
|
||||||
/>
|
/>
|
||||||
<QRadio
|
<QRadio
|
||||||
|
v-if="!props.isMasiveEdit"
|
||||||
v-model="inclusionType"
|
v-model="inclusionType"
|
||||||
dense
|
dense
|
||||||
val="indefinitely"
|
val="indefinitely"
|
||||||
|
@ -132,6 +179,7 @@ onMounted(() => {
|
||||||
data-cy="ZoneEventInclusionIndefinitelyRadio"
|
data-cy="ZoneEventInclusionIndefinitelyRadio"
|
||||||
/>
|
/>
|
||||||
<QRadio
|
<QRadio
|
||||||
|
v-if="!props.isMasiveEdit"
|
||||||
v-model="inclusionType"
|
v-model="inclusionType"
|
||||||
dense
|
dense
|
||||||
val="range"
|
val="range"
|
||||||
|
|
|
@ -34,9 +34,10 @@ const onSelected = async (val, node) => {
|
||||||
node.selected
|
node.selected
|
||||||
? '--checked'
|
? '--checked'
|
||||||
: node.selected == false
|
: node.selected == false
|
||||||
? '--unchecked'
|
? '--unchecked'
|
||||||
: '--indeterminate',
|
: '--indeterminate',
|
||||||
]"
|
]"
|
||||||
|
data-cy="ZoneLocationTreeCheckbox"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</ZoneLocationsTree>
|
</ZoneLocationsTree>
|
||||||
|
|
|
@ -42,7 +42,7 @@ const refreshEvents = () => {
|
||||||
days.value = {};
|
days.value = {};
|
||||||
if (!data.value) return;
|
if (!data.value) return;
|
||||||
|
|
||||||
let day = new Date(firstDay.value.getTime());
|
let day = new Date(firstDay?.value?.getTime());
|
||||||
|
|
||||||
while (day <= lastDay.value) {
|
while (day <= lastDay.value) {
|
||||||
let stamp = day.getTime();
|
let stamp = day.getTime();
|
||||||
|
@ -156,7 +156,7 @@ watch(
|
||||||
(value) => {
|
(value) => {
|
||||||
data.value = value;
|
data.value = value;
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const getMonthNameAndYear = (date) => {
|
const getMonthNameAndYear = (date) => {
|
||||||
|
|
|
@ -14,7 +14,11 @@ import VnTable from 'src/components/VnTable/VnTable.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';
|
||||||
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
|
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
import ZoneEventInclusionForm from './Card/ZoneEventInclusionForm.vue';
|
||||||
|
import ZoneEventExclusionForm from './Card/ZoneEventExclusionForm.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -24,6 +28,11 @@ const { openConfirmationModal } = useVnConfirm();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const warehouseOptions = ref([]);
|
const warehouseOptions = ref([]);
|
||||||
const dataKey = 'ZoneList';
|
const dataKey = 'ZoneList';
|
||||||
|
const selectedRows = ref([]);
|
||||||
|
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
||||||
|
const openInclusionForm = ref();
|
||||||
|
const showZoneEventForm = ref(false);
|
||||||
|
const zoneIds = ref({});
|
||||||
const tableFilter = {
|
const tableFilter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -191,6 +200,16 @@ const exprBuilder = (param, value) => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function openForm(value, rows) {
|
||||||
|
zoneIds.value = rows.map((row) => row.id);
|
||||||
|
openInclusionForm.value = value;
|
||||||
|
showZoneEventForm.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeEventForm = () => {
|
||||||
|
showZoneEventForm.value = false;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -206,6 +225,28 @@ const exprBuilder = (param, value) => {
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #body>
|
<template #body>
|
||||||
|
<VnSubToolbar>
|
||||||
|
<template #st-actions>
|
||||||
|
<QBtnGroup style="column-gap: 10px">
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon-right="event_available"
|
||||||
|
:disable="!hasSelectedRows"
|
||||||
|
@click="openForm(true, selectedRows)"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('list.includeEvent') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon-right="event_busy"
|
||||||
|
:disable="!hasSelectedRows"
|
||||||
|
@click="openForm(false, selectedRows)"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('list.excludeEvent') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</QBtnGroup>
|
||||||
|
</template>
|
||||||
|
</VnSubToolbar>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<div class="column items-center">
|
<div class="column items-center">
|
||||||
<VnTable
|
<VnTable
|
||||||
|
@ -220,6 +261,11 @@ const exprBuilder = (param, value) => {
|
||||||
formInitialData: {},
|
formInitialData: {},
|
||||||
}"
|
}"
|
||||||
table-height="85vh"
|
table-height="85vh"
|
||||||
|
v-model:selected="selectedRows"
|
||||||
|
:table="{
|
||||||
|
'row-key': 'id',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #column-addressFk="{ row }">
|
<template #column-addressFk="{ row }">
|
||||||
{{ dashIfEmpty(formatRow(row)) }}
|
{{ dashIfEmpty(formatRow(row)) }}
|
||||||
|
@ -271,6 +317,21 @@ const exprBuilder = (param, value) => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnSection>
|
</VnSection>
|
||||||
|
<QDialog v-model="showZoneEventForm" @hide="closeEventForm()">
|
||||||
|
<ZoneEventInclusionForm
|
||||||
|
v-if="openInclusionForm"
|
||||||
|
:event="'event'"
|
||||||
|
:is-masive-edit="true"
|
||||||
|
:zone-ids="zoneIds"
|
||||||
|
@close-form="closeEventForm"
|
||||||
|
/>
|
||||||
|
<ZoneEventExclusionForm
|
||||||
|
v-else
|
||||||
|
:zone-ids="zoneIds"
|
||||||
|
:is-masive-edit="true"
|
||||||
|
@close-form="closeEventForm"
|
||||||
|
/>
|
||||||
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -25,6 +25,7 @@ list:
|
||||||
agency: Agency
|
agency: Agency
|
||||||
close: Close
|
close: Close
|
||||||
price: Price
|
price: Price
|
||||||
|
priceOptimum: Optimal price
|
||||||
create: Create zone
|
create: Create zone
|
||||||
openSummary: Details
|
openSummary: Details
|
||||||
searchZone: Search zones
|
searchZone: Search zones
|
||||||
|
@ -37,6 +38,8 @@ list:
|
||||||
createZone: Create zone
|
createZone: Create zone
|
||||||
zoneSummary: Summary
|
zoneSummary: Summary
|
||||||
addressFk: Address
|
addressFk: Address
|
||||||
|
includeEvent: Include event
|
||||||
|
excludeEvent: Exclude event
|
||||||
create:
|
create:
|
||||||
name: Name
|
name: Name
|
||||||
closingHour: Closing hour
|
closingHour: Closing hour
|
||||||
|
|
|
@ -39,6 +39,8 @@ list:
|
||||||
createZone: Crear zona
|
createZone: Crear zona
|
||||||
zoneSummary: Resumen
|
zoneSummary: Resumen
|
||||||
addressFk: Consignatario
|
addressFk: Consignatario
|
||||||
|
includeEvent: Incluir evento
|
||||||
|
excludeEvent: Excluir evento
|
||||||
create:
|
create:
|
||||||
closingHour: Hora de cierre
|
closingHour: Hora de cierre
|
||||||
itemMaxSize: Medida máxima
|
itemMaxSize: Medida máxima
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
import { describe, expect, it, beforeEach } from 'vitest';
|
||||||
|
import 'app/test/vitest/helper';
|
||||||
|
|
||||||
|
import { useDescriptorStore } from 'src/stores/useDescriptorStore';
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
|
describe('useDescriptorStore', () => {
|
||||||
|
const { get, has } = useDescriptorStore();
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
stateStore.setDescriptors({});
|
||||||
|
});
|
||||||
|
|
||||||
|
function getDescriptors() {
|
||||||
|
return stateStore.descriptors;
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should get descriptors in stateStore', async () => {
|
||||||
|
expect(Object.keys(getDescriptors()).length).toBe(0);
|
||||||
|
get();
|
||||||
|
expect(Object.keys(getDescriptors()).length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should find ticketDescriptor if search ticketFk', async () => {
|
||||||
|
expect(has('ticketFk')).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { defineAsyncComponent } from 'vue';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
|
export const useDescriptorStore = defineStore('descriptorStore', () => {
|
||||||
|
const { descriptors, setDescriptors } = useStateStore();
|
||||||
|
function get() {
|
||||||
|
if (Object.keys(descriptors).length) return descriptors;
|
||||||
|
|
||||||
|
const currentDescriptors = {};
|
||||||
|
const files = import.meta.glob(`/src/**/*DescriptorProxy.vue`);
|
||||||
|
const moduleParser = {
|
||||||
|
account: 'user',
|
||||||
|
client: 'customer',
|
||||||
|
};
|
||||||
|
for (const file in files) {
|
||||||
|
const name = file.split('/').at(-1).slice(0, -19).toLowerCase();
|
||||||
|
const descriptor = moduleParser[name] ?? name;
|
||||||
|
currentDescriptors[descriptor + 'Fk'] = defineAsyncComponent(
|
||||||
|
() => import(/* @vite-ignore */ file),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setDescriptors(currentDescriptors);
|
||||||
|
return currentDescriptors;
|
||||||
|
}
|
||||||
|
|
||||||
|
function has(name) {
|
||||||
|
return get()[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
has,
|
||||||
|
get,
|
||||||
|
};
|
||||||
|
});
|
|
@ -8,6 +8,7 @@ export const useStateStore = defineStore('stateStore', () => {
|
||||||
const rightAdvancedDrawer = ref(false);
|
const rightAdvancedDrawer = ref(false);
|
||||||
const subToolbar = ref(false);
|
const subToolbar = ref(false);
|
||||||
const cardDescriptor = ref(null);
|
const cardDescriptor = ref(null);
|
||||||
|
const descriptors = ref({});
|
||||||
|
|
||||||
function cardDescriptorChangeValue(descriptor) {
|
function cardDescriptorChangeValue(descriptor) {
|
||||||
cardDescriptor.value = descriptor;
|
cardDescriptor.value = descriptor;
|
||||||
|
@ -52,6 +53,10 @@ export const useStateStore = defineStore('stateStore', () => {
|
||||||
return subToolbar.value;
|
return subToolbar.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setDescriptors(value) {
|
||||||
|
descriptors.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cardDescriptor,
|
cardDescriptor,
|
||||||
cardDescriptorChangeValue,
|
cardDescriptorChangeValue,
|
||||||
|
@ -68,5 +73,7 @@ export const useStateStore = defineStore('stateStore', () => {
|
||||||
isSubToolbarShown,
|
isSubToolbarShown,
|
||||||
toggleSubToolbar,
|
toggleSubToolbar,
|
||||||
rightDrawerChangeValue,
|
rightDrawerChangeValue,
|
||||||
|
descriptors,
|
||||||
|
setDescriptors,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,14 +77,14 @@ export const useWeekdayStore = defineStore('weekdayStore', () => {
|
||||||
const locales = {};
|
const locales = {};
|
||||||
for (let code of localeOrder.es) {
|
for (let code of localeOrder.es) {
|
||||||
const weekDay = weekdaysMap[code];
|
const weekDay = weekdaysMap[code];
|
||||||
const locale = t(`weekdays.${weekdaysMap[code].code}`);
|
const locale = t(`weekdays.${weekDay?.code}`);
|
||||||
const obj = {
|
const obj = {
|
||||||
...weekDay,
|
...weekDay,
|
||||||
locale,
|
locale,
|
||||||
localeChar: locale.substr(0, 1),
|
localeChar: locale.substr(0, 1),
|
||||||
localeAbr: locale.substr(0, 3),
|
localeAbr: locale.substr(0, 3),
|
||||||
};
|
};
|
||||||
locales[weekDay.code] = obj;
|
locales[weekDay?.code] = obj;
|
||||||
}
|
}
|
||||||
return locales;
|
return locales;
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,4 +22,10 @@ describe('VnLog', () => {
|
||||||
cy.get('.q-page').click();
|
cy.get('.q-page').click();
|
||||||
cy.validateContent(chips[0], 'Claim');
|
cy.validateContent(chips[0], 'Claim');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show claimDescriptor', () => {
|
||||||
|
cy.dataCy('iconLaunch-claimFk').first().click();
|
||||||
|
cy.dataCy('descriptor_id').contains('1');
|
||||||
|
cy.dataCy('iconLaunch-claimFk').first().click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
describe('ZoneCalendar', () => {
|
describe('ZoneCalendar', () => {
|
||||||
const addEventBtn = '.q-page-sticky > div > .q-btn';
|
const addEventBtn = '.q-page-sticky > div > .q-btn';
|
||||||
const submitBtn = '.q-mt-lg > .q-btn--standard';
|
const submitBtn = '.q-mt-lg > .q-btn--standard';
|
||||||
const deleteBtn = '[data-cy="ZoneEventsPanelDeleteBtn"]';
|
const deleteBtn = 'ZoneEventsPanelDeleteBtn';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
|
||||||
cy.visit(`/#/zone/13/events`);
|
cy.visit(`/#/zone/13/events`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ describe('ZoneCalendar', () => {
|
||||||
cy.dataCy('ZoneEventInclusionDayRadio').click();
|
cy.dataCy('ZoneEventInclusionDayRadio').click();
|
||||||
cy.get('.q-card > :nth-child(5)').type('01/01/2001');
|
cy.get('.q-card > :nth-child(5)').type('01/01/2001');
|
||||||
cy.get(submitBtn).click();
|
cy.get(submitBtn).click();
|
||||||
cy.get(deleteBtn).click();
|
cy.dataCy(deleteBtn).click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ describe('ZoneCalendar', () => {
|
||||||
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
|
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
|
||||||
cy.get('.flex > .q-gutter-x-sm > :nth-child(2)').click();
|
cy.get('.flex > .q-gutter-x-sm > :nth-child(2)').click();
|
||||||
cy.get(submitBtn).click();
|
cy.get(submitBtn).click();
|
||||||
cy.get(deleteBtn).click();
|
cy.dataCy(deleteBtn).click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ describe('ZoneCalendar', () => {
|
||||||
cy.dataCy('From_inputDate').type('01/01/2001');
|
cy.dataCy('From_inputDate').type('01/01/2001');
|
||||||
cy.dataCy('To_inputDate').type('31/01/2001');
|
cy.dataCy('To_inputDate').type('31/01/2001');
|
||||||
cy.get(submitBtn).click();
|
cy.get(submitBtn).click();
|
||||||
cy.get(deleteBtn).click();
|
cy.dataCy(deleteBtn).click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ describe('ZoneDeliveryDays', () => {
|
||||||
cy.get('@focusedElement').blur();
|
cy.get('@focusedElement').blur();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.get('.q-menu').should('not.exist');
|
|
||||||
|
|
||||||
cy.dataCy('ZoneDeliveryDaysAgencySelect').type(agency);
|
cy.dataCy('ZoneDeliveryDaysAgencySelect').type(agency);
|
||||||
cy.get('.q-menu .q-item').contains(agency).click();
|
cy.get('.q-menu .q-item').contains(agency).click();
|
||||||
|
@ -49,7 +48,6 @@ describe('ZoneDeliveryDays', () => {
|
||||||
cy.get('@focusedElement').blur();
|
cy.get('@focusedElement').blur();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.get('.q-menu').should('not.exist');
|
|
||||||
|
|
||||||
cy.get(submitForm).click();
|
cy.get(submitForm).click();
|
||||||
cy.wait('@events').then((interception) => {
|
cy.wait('@events').then((interception) => {
|
||||||
|
|
|
@ -1,26 +1,59 @@
|
||||||
describe.skip('ZoneLocations', () => {
|
describe('ZoneLocations', () => {
|
||||||
const data = {
|
const cp = 46680;
|
||||||
Warehouse: { val: 'Warehouse One', type: 'select' },
|
const searchIcon = '.router-link-active > .q-icon';
|
||||||
};
|
|
||||||
|
|
||||||
const postalCode =
|
|
||||||
'[style=""] > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > .q-tree__node--parent > .q-tree__node-collapsible > .q-tree__children';
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/zone/2/location`);
|
cy.visit(`/#/zone/2/location`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show all locations on entry', () => {
|
it('should be able to search by postal code', () => {
|
||||||
cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)')
|
cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)')
|
||||||
.children()
|
.should('exist')
|
||||||
.should('have.length', 9);
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.intercept('GET', '**/api/Zones/2/getLeaves*', (req) => {
|
||||||
|
req.headers['cache-control'] = 'no-cache';
|
||||||
|
req.headers['pragma'] = 'no-cache';
|
||||||
|
req.headers['expires'] = '0';
|
||||||
|
|
||||||
|
req.on('response', (res) => {
|
||||||
|
delete res.headers['if-none-match'];
|
||||||
|
delete res.headers['if-modified-since'];
|
||||||
|
});
|
||||||
|
}).as('location');
|
||||||
|
cy.get('#searchbarForm').type(cp);
|
||||||
|
cy.get(searchIcon).click();
|
||||||
|
cy.wait('@location').then((interception) => {
|
||||||
|
const data = interception.response.body;
|
||||||
|
expect(data).to.include(cp);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to search by postal code', () => {
|
it('should check, uncheck, and set a location to mixed state', () => {
|
||||||
cy.get('#searchbarForm').type('46680');
|
cy.get('#searchbarForm').type(cp);
|
||||||
cy.get('.router-link-active > .q-icon').click();
|
cy.get(searchIcon).click();
|
||||||
cy.get(postalCode).should('include.text', '46680');
|
|
||||||
|
cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)')
|
||||||
|
.as('tree')
|
||||||
|
.within(() => {
|
||||||
|
cy.get('[data-cy="ZoneLocationTreeCheckbox"] > .q-checkbox__inner')
|
||||||
|
.last()
|
||||||
|
.as('lastCheckbox');
|
||||||
|
|
||||||
|
const verifyCheckboxState = (state) => {
|
||||||
|
cy.get('@lastCheckbox')
|
||||||
|
.parents('.q-checkbox')
|
||||||
|
.should('have.attr', 'aria-checked', state);
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.get('@lastCheckbox').click();
|
||||||
|
verifyCheckboxState('true');
|
||||||
|
|
||||||
|
cy.get('@lastCheckbox').click();
|
||||||
|
verifyCheckboxState('false');
|
||||||
|
|
||||||
|
cy.get('@lastCheckbox').click();
|
||||||
|
verifyCheckboxState('mixed');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue