Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
ae0158d529
|
@ -49,6 +49,7 @@ globals:
|
||||||
rowRemoved: Row removed
|
rowRemoved: Row removed
|
||||||
pleaseWait: Please wait...
|
pleaseWait: Please wait...
|
||||||
noPinnedModules: You don't have any pinned modules
|
noPinnedModules: You don't have any pinned modules
|
||||||
|
enterToConfirm: Press Enter to confirm
|
||||||
summary:
|
summary:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
daysOnward: Days onward
|
daysOnward: Days onward
|
||||||
|
|
|
@ -51,6 +51,7 @@ globals:
|
||||||
pleaseWait: Por favor espera...
|
pleaseWait: Por favor espera...
|
||||||
noPinnedModules: No has fijado ningún módulo
|
noPinnedModules: No has fijado ningún módulo
|
||||||
split: Split
|
split: Split
|
||||||
|
enterToConfirm: Pulsa Enter para confirmar
|
||||||
summary:
|
summary:
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
daysOnward: Días adelante
|
daysOnward: Días adelante
|
||||||
|
|
|
@ -21,6 +21,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: 'mana',
|
default: 'mana',
|
||||||
},
|
},
|
||||||
|
sale: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['save', 'cancel']);
|
const emit = defineEmits(['save', 'cancel']);
|
||||||
|
@ -29,8 +33,8 @@ const { t } = useI18n();
|
||||||
const QPopupProxyRef = ref(null);
|
const QPopupProxyRef = ref(null);
|
||||||
const manaCode = ref($props.manaCode);
|
const manaCode = ref($props.manaCode);
|
||||||
|
|
||||||
const save = () => {
|
const save = (sale = $props.sale) => {
|
||||||
emit('save');
|
emit('save', sale);
|
||||||
QPopupProxyRef.value.hide();
|
QPopupProxyRef.value.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,10 +42,11 @@ const cancel = () => {
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
QPopupProxyRef.value.hide();
|
QPopupProxyRef.value.hide();
|
||||||
};
|
};
|
||||||
|
defineExpose({ save });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketEditManaProxy">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<QSpinner v-if="!mana" color="primary" size="md" />
|
<QSpinner v-if="!mana" color="primary" size="md" />
|
||||||
<div v-else>
|
<div v-else>
|
||||||
|
|
|
@ -22,7 +22,6 @@ import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
|
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
@ -33,6 +32,7 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const editPriceProxyRef = ref(null);
|
const editPriceProxyRef = ref(null);
|
||||||
|
const editManaProxyRef = ref(null);
|
||||||
const stateBtnDropdownRef = ref(null);
|
const stateBtnDropdownRef = ref(null);
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const arrayData = useArrayData('Ticket');
|
const arrayData = useArrayData('Ticket');
|
||||||
|
@ -53,7 +53,6 @@ const transfer = ref({
|
||||||
sales: [],
|
sales: [],
|
||||||
});
|
});
|
||||||
const tableRef = ref([]);
|
const tableRef = ref([]);
|
||||||
const canProceed = ref();
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
|
@ -133,7 +132,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('globals.amount'),
|
label: t('globals.amount'),
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
format: (row) => toCurrency(getSaleTotal(row)),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -183,8 +181,6 @@ const resetChanges = async () => {
|
||||||
};
|
};
|
||||||
const rowToUpdate = ref(null);
|
const rowToUpdate = ref(null);
|
||||||
const changeQuantity = async (sale) => {
|
const changeQuantity = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
if (
|
if (
|
||||||
!sale.itemFk ||
|
!sale.itemFk ||
|
||||||
sale.quantity == null ||
|
sale.quantity == null ||
|
||||||
|
@ -193,11 +189,21 @@ const changeQuantity = async (sale) => {
|
||||||
return;
|
return;
|
||||||
if (!sale.id) return addSale(sale);
|
if (!sale.id) return addSale(sale);
|
||||||
|
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updateQuantity(sale));
|
||||||
|
} else await updateQuantity(sale);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateQuantity = async (sale) => {
|
||||||
try {
|
try {
|
||||||
|
let { quantity, id } = sale;
|
||||||
if (!rowToUpdate.value) return;
|
if (!rowToUpdate.value) return;
|
||||||
rowToUpdate.value = null;
|
rowToUpdate.value = null;
|
||||||
sale.isNew = false;
|
sale.isNew = false;
|
||||||
await updateQuantity(sale);
|
const params = { quantity: quantity };
|
||||||
|
await axios.post(`Sales/${id}/updateQuantity`, params);
|
||||||
|
notify('globals.dataSaved', 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
||||||
(s) => s.id === sale.id,
|
(s) => s.id === sale.id,
|
||||||
|
@ -207,12 +213,6 @@ const changeQuantity = async (sale) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateQuantity = async ({ quantity, id }) => {
|
|
||||||
const params = { quantity: quantity };
|
|
||||||
await axios.post(`Sales/${id}/updateQuantity`, params);
|
|
||||||
notify('globals.dataSaved', 'positive');
|
|
||||||
};
|
|
||||||
|
|
||||||
const addSale = async (sale) => {
|
const addSale = async (sale) => {
|
||||||
const params = {
|
const params = {
|
||||||
barcode: sale.itemFk,
|
barcode: sale.itemFk,
|
||||||
|
@ -237,13 +237,17 @@ const addSale = async (sale) => {
|
||||||
sale.isNew = false;
|
sale.isNew = false;
|
||||||
arrayData.fetch({});
|
arrayData.fetch({});
|
||||||
};
|
};
|
||||||
|
const changeConcept = async (sale) => {
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updateConcept(sale));
|
||||||
|
} else await updateConcept(sale);
|
||||||
|
};
|
||||||
|
|
||||||
const updateConcept = async (sale) => {
|
const updateConcept = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const data = { newConcept: sale.concept };
|
const data = { newConcept: sale.concept };
|
||||||
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_EDIT = {
|
const DEFAULT_EDIT = {
|
||||||
|
@ -295,33 +299,43 @@ const onOpenEditDiscountPopover = async (sale) => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const changePrice = async (sale) => {
|
||||||
const updatePrice = async (sale) => {
|
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const newPrice = edit.value.price;
|
const newPrice = edit.value.price;
|
||||||
if (newPrice != null && newPrice != sale.price) {
|
if (newPrice != null && newPrice != sale.price) {
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updatePrice(sale, newPrice));
|
||||||
|
} else updatePrice(sale, newPrice);
|
||||||
|
}
|
||||||
|
await getMana();
|
||||||
|
};
|
||||||
|
const updatePrice = async (sale, newPrice) => {
|
||||||
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
||||||
sale.price = newPrice;
|
sale.price = newPrice;
|
||||||
edit.value = { ...DEFAULT_EDIT };
|
edit.value = { ...DEFAULT_EDIT };
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
}
|
tableRef.value.reload();
|
||||||
|
|
||||||
await getMana();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeDiscount = async (sale) => {
|
const changeDiscount = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const newDiscount = edit.value.discount;
|
const newDiscount = edit.value.discount;
|
||||||
if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
|
if (newDiscount != null && newDiscount != sale.discount) {
|
||||||
|
if (await isSalePrepared(sale))
|
||||||
|
await confirmUpdate(() => updateDiscount([sale], newDiscount));
|
||||||
|
else await updateDiscount([sale], newDiscount);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateDiscounts = async (sales, newDiscount = null) => {
|
||||||
|
const salesTracking = await fetchSalesTracking();
|
||||||
|
|
||||||
|
const someSaleIsPrepared = salesTracking.some((sale) =>
|
||||||
|
matchSale(salesTracking, sale),
|
||||||
|
);
|
||||||
|
if (someSaleIsPrepared) await confirmUpdate(() => updateDiscount(sales, newDiscount));
|
||||||
|
else updateDiscount(sales, newDiscount);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDiscount = async (sales, newDiscount = null) => {
|
const updateDiscount = async (sales, newDiscount = null) => {
|
||||||
for (const sale of sales) {
|
|
||||||
const canProceed = await isSalePrepared(sale);
|
|
||||||
if (!canProceed) return;
|
|
||||||
}
|
|
||||||
const saleIds = sales.map((sale) => sale.id);
|
const saleIds = sales.map((sale) => sale.id);
|
||||||
const _newDiscount = newDiscount || edit.value.discount;
|
const _newDiscount = newDiscount || edit.value.discount;
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -424,9 +438,13 @@ onMounted(async () => {
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
const newRow = ref({});
|
const newRow = ref({});
|
||||||
|
|
||||||
|
const changeItem = async (sale) => {
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updateItem(sale));
|
||||||
|
} else await updateItem(sale);
|
||||||
|
};
|
||||||
|
|
||||||
const updateItem = async (row) => {
|
const updateItem = async (row) => {
|
||||||
canProceed.value = await isSalePrepared(row);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
row.item = selectedItem;
|
row.item = selectedItem;
|
||||||
|
@ -470,7 +488,18 @@ const endNewRow = (row) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function isSalePrepared(item) {
|
async function confirmUpdate(cb) {
|
||||||
|
await quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Item prepared'),
|
||||||
|
message: t('This item is already prepared. Do you want to continue?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(cb);
|
||||||
|
}
|
||||||
|
async function fetchSalesTracking() {
|
||||||
const filter = {
|
const filter = {
|
||||||
params: {
|
params: {
|
||||||
where: { ticketFk: route.params.id },
|
where: { ticketFk: route.params.id },
|
||||||
|
@ -482,48 +511,37 @@ async function isSalePrepared(item) {
|
||||||
filter: JSON.stringify(filter),
|
filter: JSON.stringify(filter),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
return data;
|
||||||
const matchingSale = data.find((sale) => sale.itemFk === item.itemFk);
|
|
||||||
if (!matchingSale) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
matchingSale.hasSaleGroupDetail ||
|
|
||||||
matchingSale.isControled ||
|
|
||||||
matchingSale.isPrepared ||
|
|
||||||
matchingSale.isPrevious ||
|
|
||||||
matchingSale.isPreviousSelected
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
quasar
|
|
||||||
.dialog({
|
|
||||||
component: VnConfirm,
|
|
||||||
componentProps: {
|
|
||||||
title: t('Item prepared'),
|
|
||||||
message: t(
|
|
||||||
'This item is already prepared. Do you want to continue?',
|
|
||||||
),
|
|
||||||
data: item,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.onOk(() => resolve(true))
|
|
||||||
.onCancel(() => reject(new Error('cancelled')));
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
tableRef.value.reload();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isSalePrepared(sale) {
|
||||||
|
const data = await fetchSalesTracking();
|
||||||
|
return matchSale(data, sale);
|
||||||
|
}
|
||||||
|
function matchSale(data, sale) {
|
||||||
|
const matchingSale = data.find(({ itemFk }) => itemFk === sale.itemFk);
|
||||||
|
|
||||||
|
if (!matchingSale) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isPrepared(matchingSale);
|
||||||
|
}
|
||||||
|
function isPrepared(sale) {
|
||||||
|
const flagsToCheck = [
|
||||||
|
'hasSaleGroupDetail',
|
||||||
|
'isControled',
|
||||||
|
'isPrepared',
|
||||||
|
'isPrevious',
|
||||||
|
'isPreviousSelected',
|
||||||
|
];
|
||||||
|
return flagsToCheck.some((flag) => sale[flag] === 1);
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => newRow.value.itemFk,
|
() => newRow.value.itemFk,
|
||||||
(newItemFk) => {
|
(newItemFk) => {
|
||||||
if (newItemFk) {
|
if (newItemFk) {
|
||||||
updateItem(newRow.value);
|
changeItem(newRow.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -584,7 +602,7 @@ watch(
|
||||||
:mana="mana"
|
:mana="mana"
|
||||||
:ticket-config="ticketConfig"
|
:ticket-config="ticketConfig"
|
||||||
@get-mana="getMana()"
|
@get-mana="getMana()"
|
||||||
@update-discounts="updateDiscount"
|
@update-discounts="updateDiscounts"
|
||||||
@refresh-table="resetChanges"
|
@refresh-table="resetChanges"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -715,7 +733,7 @@ watch(
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.itemFk"
|
v-model="row.itemFk"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
@update:model-value="updateItem(row)"
|
@update:model-value="changeItem(row)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -741,16 +759,21 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
<FetchedTags :item="row" :max-length="6" />
|
<FetchedTags :item="row" :max-length="6" />
|
||||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||||
<VnInput v-model="row.concept" @change="updateConcept(row)" />
|
<VnInput
|
||||||
|
v-model="row.concept"
|
||||||
|
@keyup.enter.stop="changeConcept(row)"
|
||||||
|
:hint="t('globals.enterToConfirm')"
|
||||||
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
<template #column-quantity="{ row }">
|
<template #column-quantity="{ row }">
|
||||||
<VnInput
|
<VnInput
|
||||||
|
data-cy="ticketSaleQuantityInput"
|
||||||
v-if="row.isNew || isTicketEditable"
|
v-if="row.isNew || isTicketEditable"
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
@blur="changeQuantity(row)"
|
@blur="changeQuantity(row)"
|
||||||
@keyup.enter="changeQuantity(row)"
|
@keyup.enter.stop="changeQuantity(row)"
|
||||||
@update:model-value="() => (rowToUpdate = row)"
|
@update:model-value="() => (rowToUpdate = row)"
|
||||||
@focus="edit.oldQuantity = row.quantity"
|
@focus="edit.oldQuantity = row.quantity"
|
||||||
/>
|
/>
|
||||||
|
@ -764,10 +787,12 @@ watch(
|
||||||
<TicketEditManaProxy
|
<TicketEditManaProxy
|
||||||
ref="editPriceProxyRef"
|
ref="editPriceProxyRef"
|
||||||
:mana="mana"
|
:mana="mana"
|
||||||
|
:sale="row"
|
||||||
:new-price="getNewPrice"
|
:new-price="getNewPrice"
|
||||||
@save="updatePrice(row)"
|
@save="changePrice"
|
||||||
>
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@keyup.enter.stop="() => editManaProxyRef.save(row)"
|
||||||
v-model.number="edit.price"
|
v-model.number="edit.price"
|
||||||
:label="t('basicData.price')"
|
:label="t('basicData.price')"
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -781,31 +806,30 @@ watch(
|
||||||
<QBtn flat class="link" dense @click="onOpenEditDiscountPopover(row)">
|
<QBtn flat class="link" dense @click="onOpenEditDiscountPopover(row)">
|
||||||
{{ toPercentage(row.discount / 100) }}
|
{{ toPercentage(row.discount / 100) }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
||||||
<TicketEditManaProxy
|
<TicketEditManaProxy
|
||||||
|
ref="editManaProxyRef"
|
||||||
:mana="mana"
|
:mana="mana"
|
||||||
|
:sale="row"
|
||||||
:new-price="getNewPrice"
|
:new-price="getNewPrice"
|
||||||
:uses-mana="usesMana"
|
:uses-mana="usesMana"
|
||||||
:mana-code="manaCode"
|
:mana-code="manaCode"
|
||||||
@save="changeDiscount(row)"
|
@save="changeDiscount"
|
||||||
>
|
>
|
||||||
<template #default="{ popup }">
|
|
||||||
<VnInput
|
<VnInput
|
||||||
autofocus
|
autofocus
|
||||||
@keyup.enter="
|
@keyup.enter.stop="() => editManaProxyRef.save(row)"
|
||||||
() => {
|
|
||||||
changeDiscount(row);
|
|
||||||
popup.hide();
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model.number="edit.discount"
|
v-model.number="edit.discount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</template>
|
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-amount="{ row }">
|
||||||
|
{{ toCurrency(getSaleTotal(row)) }}
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
|
|
|
@ -209,7 +209,7 @@ const onThermographCreated = async (data) => {
|
||||||
}"
|
}"
|
||||||
sort-by="thermographFk ASC"
|
sort-by="thermographFk ASC"
|
||||||
option-label="thermographFk"
|
option-label="thermographFk"
|
||||||
option-filter-value="id"
|
option-filter-value="thermographFk"
|
||||||
:disable="viewAction === 'edit'"
|
:disable="viewAction === 'edit'"
|
||||||
:tooltip="t('New thermograph')"
|
:tooltip="t('New thermograph')"
|
||||||
:roles-allowed-to-create="['logistic']"
|
:roles-allowed-to-create="['logistic']"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
describe('TicketSale', () => {
|
describe('TicketSale', () => {
|
||||||
|
describe('Free ticket #31', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -119,4 +120,89 @@ describe('TicketSale', () => {
|
||||||
cy.get(firstRow).find('.q-btn:last').click();
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
cy.url().should('match', /\/ticket\/31\/log/);
|
cy.url().should('match', /\/ticket\/31\/log/);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
describe('Ticket prepared #23', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/23/sale');
|
||||||
|
});
|
||||||
|
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
const selectFirstRow = () => {
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
||||||
|
};
|
||||||
|
|
||||||
|
it('update price', () => {
|
||||||
|
const price = Number((Math.random() * 99 + 1).toFixed(2));
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(':nth-child(10) > .q-btn').click();
|
||||||
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
|
cy.waitForElement('[data-cy="Price_input"]');
|
||||||
|
cy.dataCy('Price_input').clear();
|
||||||
|
cy.dataCy('Price_input').type(price);
|
||||||
|
cy.dataCy('saveManaBtn').click();
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get(':nth-child(10) > .q-btn > .q-btn__content').should(
|
||||||
|
'have.text',
|
||||||
|
`€${price}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('update dicount', () => {
|
||||||
|
const discount = Math.floor(Math.random() * 100) + 1;
|
||||||
|
selectFirstRow();
|
||||||
|
cy.get(':nth-child(11) > .q-btn').click();
|
||||||
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
|
cy.waitForElement('[data-cy="Disc_input"]');
|
||||||
|
cy.dataCy('Disc_input').clear();
|
||||||
|
cy.dataCy('Disc_input').type(discount);
|
||||||
|
cy.dataCy('saveManaBtn').click();
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get(':nth-child(11) > .q-btn > .q-btn__content').should(
|
||||||
|
'have.text',
|
||||||
|
`${discount}.00%`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('change concept', () => {
|
||||||
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(':nth-child(8) > .row').click();
|
||||||
|
cy.get(
|
||||||
|
'.q-menu > [data-v-ca3f07a4=""] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="undefined_input"]',
|
||||||
|
)
|
||||||
|
.type(quantity)
|
||||||
|
.type('{enter}');
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get(':nth-child(8) >.row').should('contain.text', `${quantity}`);
|
||||||
|
});
|
||||||
|
it('changequantity ', () => {
|
||||||
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.dataCy('ticketSaleQuantityInput').clear();
|
||||||
|
cy.dataCy('ticketSaleQuantityInput').type(quantity).trigger('tab');
|
||||||
|
cy.get('.q-page > :nth-child(6)').click();
|
||||||
|
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get('[data-cy="ticketSaleQuantityInput"]')
|
||||||
|
.find('[data-cy="undefined_input"]')
|
||||||
|
.should('have.value', `${quantity}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleVnConfirm() {
|
||||||
|
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
|
||||||
|
cy.waitForElement('.q-notification__message');
|
||||||
|
|
||||||
|
cy.get('.q-notification__message').should('be.visible');
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue