@@ -761,6 +769,8 @@ watch(
+
+
+
{{ toPercentage(row.discount / 100) }}
diff --git a/src/pages/Ticket/Card/TicketSaleMoreActions.vue b/src/pages/Ticket/Card/TicketSaleMoreActions.vue
index 2ec519d2df..588f78a7b0 100644
--- a/src/pages/Ticket/Card/TicketSaleMoreActions.vue
+++ b/src/pages/Ticket/Card/TicketSaleMoreActions.vue
@@ -165,14 +165,10 @@ const createRefund = async (withWarehouse) => {
negative: true,
};
- try {
- const { data } = await axios.post('Tickets/cloneAll', params);
- const [refundTicket] = data;
- notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
- push({ name: 'TicketSale', params: { id: refundTicket.id } });
- } catch (error) {
- console.error(error);
- }
+ const { data } = await axios.post('Tickets/cloneAll', params);
+ const [refundTicket] = data;
+ notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
+ push({ name: 'TicketSale', params: { id: refundTicket.id } });
};
diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue
index e7830bf37f..1083393c4c 100644
--- a/src/pages/Ticket/Card/TicketSaleTracking.vue
+++ b/src/pages/Ticket/Card/TicketSaleTracking.vue
@@ -150,18 +150,14 @@ const shelvingsTableColumns = computed(() => [
]);
const getSaleTrackings = async (sale) => {
- try {
- const filter = {
- where: { saleFk: sale.saleFk },
- order: ['itemFk DESC'],
- };
- const { data } = await axios.get(`SaleTrackings/listSaleTracking`, {
- params: { filter: JSON.stringify(filter) },
- });
- saleTrackings.value = data;
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ where: { saleFk: sale.saleFk },
+ order: ['itemFk DESC'],
+ };
+ const { data } = await axios.get(`SaleTrackings/listSaleTracking`, {
+ params: { filter: JSON.stringify(filter) },
+ });
+ saleTrackings.value = data;
};
const showLog = async (sale) => {
@@ -170,17 +166,13 @@ const showLog = async (sale) => {
};
const getItemShelvingSales = async (sale) => {
- try {
- const filter = {
- where: { saleFk: sale.saleFk },
- };
- const { data } = await axios.get(`ItemShelvingSales/filter`, {
- params: { filter: JSON.stringify(filter) },
- });
- itemShelvingsSales.value = data;
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ where: { saleFk: sale.saleFk },
+ };
+ const { data } = await axios.get(`ItemShelvingSales/filter`, {
+ params: { filter: JSON.stringify(filter) },
+ });
+ itemShelvingsSales.value = data;
};
const showShelving = async (sale) => {
@@ -189,36 +181,28 @@ const showShelving = async (sale) => {
};
const updateQuantity = async (sale) => {
- try {
- if (oldQuantity.value === sale.quantity) return;
- const params = {
- quantity: sale.quantity,
- };
- await axios.patch(`ItemShelvingSales/${sale.id}`, params);
- oldQuantity.value = null;
- } catch (error) {
- console.error(error);
- }
+ if (oldQuantity.value === sale.quantity) return;
+ const params = {
+ quantity: sale.quantity,
+ };
+ await axios.patch(`ItemShelvingSales/${sale.id}`, params);
+ oldQuantity.value = null;
};
const updateParking = async (sale) => {
- try {
- const filter = {
- fields: ['id'],
- where: {
- code: sale.shelvingFk,
- },
- };
- const { data } = await axios.get(`Shelvings/findOne`, {
- params: { filter: JSON.stringify(filter) },
- });
- const params = {
- parkingFk: sale.parkingFk,
- };
- await axios.patch(`Shelvings/${data.id}`, params);
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ fields: ['id'],
+ where: {
+ code: sale.shelvingFk,
+ },
+ };
+ const { data } = await axios.get(`Shelvings/findOne`, {
+ params: { filter: JSON.stringify(filter) },
+ });
+ const params = {
+ parkingFk: sale.parkingFk,
+ };
+ await axios.patch(`Shelvings/${data.id}`, params);
};
const updateShelving = async (sale) => {
@@ -241,61 +225,41 @@ const updateShelving = async (sale) => {
};
const saleTrackingNew = async (sale, stateCode, isChecked) => {
- try {
- const params = {
- saleFk: sale.saleFk,
- isChecked,
- quantity: sale.quantity,
- stateCode,
- };
- await axios.post(`SaleTrackings/new`, params);
- notify(t('globals.dataSaved'), 'positive');
- } catch (error) {
- console.error(error);
- }
+ const params = {
+ saleFk: sale.saleFk,
+ isChecked,
+ quantity: sale.quantity,
+ stateCode,
+ };
+ await axios.post(`SaleTrackings/new`, params);
+ notify(t('globals.dataSaved'), 'positive');
};
const saleTrackingDel = async ({ saleFk }, stateCode) => {
- try {
- const params = {
- saleFk,
- stateCodes: [stateCode],
- };
- await axios.post(`SaleTrackings/delete`, params);
- notify(t('globals.dataSaved'), 'positive');
- } catch (error) {
- console.error(error);
- }
+ const params = {
+ saleFk,
+ stateCodes: [stateCode],
+ };
+ await axios.post(`SaleTrackings/delete`, params);
+ notify(t('globals.dataSaved'), 'positive');
};
const clickSaleGroupDetail = async (sale) => {
- try {
- if (!sale.saleGroupDetailFk) return;
+ if (!sale.saleGroupDetailFk) return;
- await axios.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`);
- sale.hasSaleGroupDetail = false;
- notify(t('globals.dataSaved'), 'positive');
- } catch (error) {
- console.error(error);
- }
+ await axios.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`);
+ sale.hasSaleGroupDetail = false;
+ notify(t('globals.dataSaved'), 'positive');
};
const clickPreviousSelected = (sale) => {
- try {
- qCheckBoxController(sale, 'isPreviousSelected');
- if (!sale.isPreviousSelected) sale.isPrevious = false;
- } catch (error) {
- console.error(error);
- }
+ qCheckBoxController(sale, 'isPreviousSelected');
+ if (!sale.isPreviousSelected) sale.isPrevious = false;
};
const clickPrevious = (sale) => {
- try {
- qCheckBoxController(sale, 'isPrevious');
- if (sale.isPrevious) sale.isPreviousSelected = true;
- } catch (error) {
- console.error(error);
- }
+ qCheckBoxController(sale, 'isPrevious');
+ if (sale.isPrevious) sale.isPreviousSelected = true;
};
const qCheckBoxController = (sale, action) => {
@@ -306,16 +270,12 @@ const qCheckBoxController = (sale, action) => {
isPreviousSelected: 'PREVIOUS_PREPARATION',
};
const stateCode = STATE_CODES[action];
- try {
- if (!sale[action]) {
- saleTrackingNew(sale, stateCode, true);
- sale[action] = true;
- } else {
- saleTrackingDel(sale, stateCode);
- sale[action] = false;
- }
- } catch (error) {
- console.error(error);
+ if (!sale[action]) {
+ saleTrackingNew(sale, stateCode, true);
+ sale[action] = true;
+ } else {
+ saleTrackingDel(sale, stateCode);
+ sale[action] = false;
}
};
diff --git a/src/pages/Ticket/Card/TicketService.vue b/src/pages/Ticket/Card/TicketService.vue
index 45a870f7f0..47c28a422e 100644
--- a/src/pages/Ticket/Card/TicketService.vue
+++ b/src/pages/Ticket/Card/TicketService.vue
@@ -46,40 +46,32 @@ watch(
onMounted(async () => await getDefaultTaxClass());
const createRefund = async () => {
- try {
- if (!selected.value.length) return;
+ if (!selected.value.length) return;
- const params = {
- servicesIds: selected.value.map((s) => +s.id),
- withWarehouse: false,
- negative: true,
- };
- const { data } = await axios.post('Sales/clone', params);
- const [refundTicket] = data;
- notify(
- t('service.createRefundSuccess', {
- ticketId: refundTicket.id,
- }),
- 'positive'
- );
- router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
- } catch (error) {
- console.error(error);
- }
+ const params = {
+ servicesIds: selected.value.map((s) => +s.id),
+ withWarehouse: false,
+ negative: true,
+ };
+ const { data } = await axios.post('Sales/clone', params);
+ const [refundTicket] = data;
+ notify(
+ t('service.createRefundSuccess', {
+ ticketId: refundTicket.id,
+ }),
+ 'positive'
+ );
+ router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
};
const getDefaultTaxClass = async () => {
- try {
- let filter = {
- where: { code: 'G' },
- };
- const { data } = await axios.get('TaxClasses/findOne', {
- params: { filter: JSON.stringify(filter) },
- });
- defaultTaxClass.value = data;
- } catch (error) {
- console.error(error);
- }
+ let filter = {
+ where: { code: 'G' },
+ };
+ const { data } = await axios.get('TaxClasses/findOne', {
+ params: { filter: JSON.stringify(filter) },
+ });
+ defaultTaxClass.value = data;
};
const columns = computed(() => [
diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue
index af96c2724f..5fb99b8494 100644
--- a/src/pages/Ticket/Card/TicketSummary.vue
+++ b/src/pages/Ticket/Card/TicketSummary.vue
@@ -19,6 +19,8 @@ import VnTitle from 'src/components/common/VnTitle.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
+import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
+import VnToSummary from 'src/components/ui/VnToSummary.vue';
const route = useRoute();
const { notify } = useNotify();
@@ -68,7 +70,7 @@ function isEditable() {
async function changeState(value) {
try {
- stateBtnDropdownRef.value.hide();
+ stateBtnDropdownRef.value?.hide();
const formData = {
ticketFk: entityId.value,
code: value,
@@ -85,6 +87,10 @@ async function changeState(value) {
function toTicketUrl(section) {
return '#/ticket/' + entityId.value + '/' + section;
}
+function isOnTicketCard() {
+ const currentPath = route.path;
+ return currentPath.startsWith('/ticket');
+}
@@ -99,6 +105,14 @@ function toTicketUrl(section) {
:url="`Tickets/${entityId}/summary`"
data-key="TicketSummary"
>
+
+
+
Ticket #{{ entity.id }} - {{ entity.client?.name }} ({{
@@ -112,7 +126,7 @@ function toTicketUrl(section) {
ref="stateBtnDropdownRef"
color="black"
text-color="white"
- :label="t('ticket.summary.changeState')"
+ :label="t('globals.changeState')"
:disable="!isEditable()"
>
[
]);
const applyVolumes = async (salesData) => {
- try {
- if (!salesData.length) return;
+ if (!salesData.length) return;
- sales.value = salesData;
- const ticket = sales.value[0].ticketFk;
- const { data } = await axios.get(`Tickets/${ticket}/getVolume`);
- const volumes = new Map(data.saleVolume.map((volume) => [volume.saleFk, volume]));
+ sales.value = salesData;
+ const ticket = sales.value[0].ticketFk;
+ const { data } = await axios.get(`Tickets/${ticket}/getVolume`);
+ const volumes = new Map(data.saleVolume.map((volume) => [volume.saleFk, volume]));
- sales.value.forEach((sale) => {
- sale.saleVolume = volumes.get(sale.id);
- });
+ sales.value.forEach((sale) => {
+ sale.saleVolume = volumes.get(sale.id);
+ });
- packingTypeVolume.value = data.packingTypeVolume;
- } catch (error) {
- console.error(error);
- }
+ packingTypeVolume.value = data.packingTypeVolume;
};
onMounted(() => (stateStore.rightDrawer = true));
diff --git a/src/pages/Ticket/TicketAdvance.vue b/src/pages/Ticket/TicketAdvance.vue
index 43b500dc01..7db2b54b3d 100644
--- a/src/pages/Ticket/TicketAdvance.vue
+++ b/src/pages/Ticket/TicketAdvance.vue
@@ -1,24 +1,20 @@
+watch(
+ () => vnTableRef.value.tableRef?.$el,
+ ($el) => {
+ if (!$el) return;
+ const head = $el.querySelector('thead');
+ const firstRow = $el.querySelector('thead > tr');
+ const newRow = document.createElement('tr');
+ destinationElRef.value = document.createElement('th');
+ originElRef.value = document.createElement('th');
+
+ newRow.classList.add('bg-header');
+ destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
+ originElRef.value.classList.add('text-uppercase', 'color-vn-label');
+
+ destinationElRef.value.setAttribute('colspan', '7');
+ originElRef.value.setAttribute('colspan', '9');
+
+ destinationElRef.value.textContent = `${t(
+ 'advanceTickets.destination'
+ )} ${toDateFormat(vnTableRef.value.params.dateToAdvance)}`;
+ originElRef.value.textContent = `${t('advanceTickets.origin')} ${toDateFormat(
+ vnTableRef.value.params.dateFuture
+ )}`;
+
+ newRow.append(destinationElRef.value, originElRef.value);
+ head.insertBefore(newRow, firstRow);
+ },
+ { once: true, inmmediate: true }
+);
+
+watch(
+ () => vnTableRef.value.params,
+ () => {
+ if (originElRef.value && destinationElRef.value) {
+ destinationElRef.value.textContent = `${t(
+ 'advanceTickets.destination'
+ )} ${toDateFormat(vnTableRef.value.params.dateToAdvance)}`;
+ originElRef.value.textContent = `${t('advanceTickets.origin')} ${toDateFormat(
+ vnTableRef.value.params.dateFuture
+ )}`;
+ }
+ },
+ { deep: true }
+);
+
{
auto-load
@on-fetch="(data) => (zonesOptions = data)"
/>
-
{
-
+
-
-
- {{ userParams.scopeDays }}
-
-
- {{ t('advanceTickets.destination') }}
- {{ toDateFormat(userParams.dateToAdvance) }}
-
-
- {{ t('advanceTickets.origin') }}
- {{ toDateFormat(userParams.dateFuture) }}
-
-
-
-
-
-
-
- {{ col.label }}
-
-
+
+
+
+
+ {{
+ t('advanceTickets.originAgency', {
+ agency: row.futureAgency,
+ })
+ }}
+
+
+ {{
+ t('advanceTickets.destinationAgency', {
+ agency: row.agency,
+ })
+ }}
+
+
+
-
-
-
-
-
-
-
+
+
+ {{ row.id }}
+
+
-
-
- {{ col.label }}
-
+
+
+ {{ row.state }}
+
+ {{ dashIfEmpty(row.state) }}
-
-
-
-
-
- {{
- t('advanceTickets.originAgency', {
- agency: row.futureAgency,
- })
- }}
-
-
- {{
- t('advanceTickets.destinationAgency', {
- agency: row.agency,
- })
- }}
-
-
-
-
+
+
+ {{ toCurrency(row.totalWithVat || 0) }}
+
-
-
-
-
- {{ row.id }}
-
-
-
+
+
+ {{ row.futureId }}
+
+
-
-
-
- {{ row.state }}
-
- {{ dashIfEmpty(row.state) }}
-
+
+
+ {{ row.futureState }}
+
-
-
-
- {{ toCurrency(row.totalWithVat || 0) }}
-
-
+
+
+ {{ toCurrency(row.futureTotalWithVat || 0) }}
+
-
-
-
- {{ row.futureId }}
-
-
-
-
-
-
-
- {{ row.futureState }}
-
-
-
-
-
-
- {{ toCurrency(row.futureTotalWithVat || 0) }}
-
-
-
-
+
{
diff --git a/src/pages/Ticket/TicketAdvanceFilter.vue b/src/pages/Ticket/TicketAdvanceFilter.vue
index b25ebdea60..a1d301f352 100644
--- a/src/pages/Ticket/TicketAdvanceFilter.vue
+++ b/src/pages/Ticket/TicketAdvanceFilter.vue
@@ -11,7 +11,7 @@ import axios from 'axios';
import { onMounted } from 'vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
-const { t } = useI18n();
+const { t, te } = useI18n();
const props = defineProps({
dataKey: {
type: String,
@@ -27,20 +27,21 @@ const warehousesOptions = ref([]);
const itemPackingTypes = ref([]);
const getItemPackingTypes = async () => {
- try {
- const filter = {
- where: { isActive: true },
- };
- const { data } = await axios.get('ItemPackingTypes', {
- params: { filter: JSON.stringify(filter) },
- });
- itemPackingTypes.value = data.map((ipt) => ({
- description: t(ipt.description),
- code: ipt.code,
- }));
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ where: { isActive: true },
+ };
+ const { data } = await axios.get('ItemPackingTypes', {
+ params: { filter: JSON.stringify(filter) },
+ });
+ itemPackingTypes.value = data.map((ipt) => ({
+ description: t(ipt.description),
+ code: ipt.code,
+ }));
+};
+
+const getLocale = (val) => {
+ const param = `params.${val}`;
+ return te(param) ? t(param) : t(`globals.${param}`);
};
onMounted(async () => await getItemPackingTypes());
@@ -53,6 +54,7 @@ onMounted(async () => await getItemPackingTypes());
auto-load
/>
await getItemPackingTypes());
>
- {{ t(`params.${tag.label}`) }}:
+ {{ getLocale(tag.label) }}:
{{ formatFn(tag.value) }}
@@ -96,6 +98,7 @@ onMounted(async () => await getItemPackingTypes());
dense
outlined
rounded
+ :use-like="false"
>
@@ -113,6 +116,7 @@ onMounted(async () => await getItemPackingTypes());
dense
outlined
rounded
+ :use-like="false"
>
@@ -136,6 +140,19 @@ onMounted(async () => await getItemPackingTypes());
/>
+
+
+
+
+
{
- (clientOptions = data)"
- :filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }"
- auto-load
- />
(warehousesOptions = data)"
@@ -137,7 +130,9 @@ const redirectToTicketList = (_, { id }) => {
{
+ for (const state of data) {
+ groupedStates.value.push({
+ id: state.id,
+ name: t(`${state.code}`),
+ code: state.code,
+ });
+ }
+};
(provinces = data)" auto-load />
(states = data)" auto-load />
- (agencies = data)" auto-load />
- (warehouses = data)" auto-load />
(workers = data)"
+ url="AlertLevels"
+ @on-fetch="
+ (data) => {
+ getGroupedStates(data);
+ }
+ "
auto-load
/>
+ (agencies = data)" auto-load />
+ (warehouses = data)" auto-load />
@@ -66,23 +80,19 @@ const warehouses = ref([]);
-
-
-
-
-
+
@@ -100,12 +110,35 @@ const warehouses = ref([]);
option-label="name"
emit-value
map-options
+ use-input
dense
outlined
rounded
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -255,6 +309,11 @@ en:
provinceFk: Province
agencyModeFk: Agency
warehouseFk: Warehouse
+ FREE: Free
+ ON_PREPARATION: On preparation
+ PACKED: Packed
+ DELIVERED: Delivered
+ ON_PREVIOUS: ON_PREVIOUS
es:
params:
search: Contiene
@@ -288,4 +347,12 @@ es:
Yes: Si
No: No
Days onward: Días adelante
+ Grouped state: Estado agrupado
+ FREE: Libre
+ ON_PREPARATION: En preparación
+ PACKED: Encajado
+ DELIVERED: Servido
+ ON_PREVIOUS: ON_PREVIOUS
+ Collection: Colección
+ Nickname: Nombre mostrado
diff --git a/src/pages/Ticket/TicketFutureFilter.vue b/src/pages/Ticket/TicketFutureFilter.vue
index 6345f62b3f..ffe9672726 100644
--- a/src/pages/Ticket/TicketFutureFilter.vue
+++ b/src/pages/Ticket/TicketFutureFilter.vue
@@ -24,33 +24,25 @@ const itemPackingTypes = ref([]);
const stateOptions = ref([]);
const getItemPackingTypes = async () => {
- try {
- const filter = {
- where: { isActive: true },
- };
- const { data } = await axios.get('ItemPackingTypes', {
- params: { filter: JSON.stringify(filter) },
- });
- itemPackingTypes.value = data.map((ipt) => ({
- description: t(ipt.description),
- code: ipt.code,
- }));
- } catch (error) {
- console.error(error);
- }
+ const filter = {
+ where: { isActive: true },
+ };
+ const { data } = await axios.get('ItemPackingTypes', {
+ params: { filter: JSON.stringify(filter) },
+ });
+ itemPackingTypes.value = data.map((ipt) => ({
+ description: t(ipt.description),
+ code: ipt.code,
+ }));
};
const getGroupedStates = async () => {
- try {
- const { data } = await axios.get('AlertLevels');
- stateOptions.value = data.map((state) => ({
- id: state.id,
- name: t(`futureTickets.${state.code}`),
- code: state.code,
- }));
- } catch (error) {
- console.error(error);
- }
+ const { data } = await axios.get('AlertLevels');
+ stateOptions.value = data.map((state) => ({
+ id: state.id,
+ name: t(`futureTickets.${state.code}`),
+ code: state.code,
+ }));
};
onMounted(async () => {
diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue
index ad97e75c15..dd1f2d69ad 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -95,6 +95,7 @@ const columns = computed(() => [
columnField: {
component: null,
},
+ columnClass: 'expand',
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
},
{
@@ -153,11 +154,6 @@ const columns = computed(() => [
},
columnClass: 'expand',
},
- {
- align: 'left',
- name: 'refFk',
- label: t('ticketList.ref'),
- },
{
align: 'left',
name: 'zoneFk',
@@ -191,6 +187,12 @@ const columns = computed(() => [
},
format: (row) => toCurrency(row.totalWithVat),
},
+ {
+ align: 'left',
+ name: 'packing',
+ label: t('ticketSale.packaging'),
+ format: (row, dashIfEmpty) => dashIfEmpty(row.packing),
+ },
{
align: 'right',
name: 'tableActions',
@@ -202,7 +204,7 @@ const columns = computed(() => [
action: (row) => redirectToLines(row.id),
},
{
- title: t('ticketList.summary'),
+ title: t('components.smartCard.viewSummary'),
icon: 'preview',
isPrimary: true,
action: (row) => viewSummary(row.id, TicketSummary),
@@ -548,7 +550,7 @@ function setReference(data) {
- {{ row.salesPerson }}
+ {{ dashIfEmpty(row.userName) }}
@@ -577,16 +579,16 @@ function setReference(data) {
{{ row.state }}
+
+
+ {{ row.refFk }}
+
+
+
{{ row.state }}
-
-
- {{ dashIfEmpty(row.refFk) }}
-
-
-
{{ dashIfEmpty(row.zoneName) }}
diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml
index b372e48ef7..eab38a4028 100644
--- a/src/pages/Ticket/locale/es.yml
+++ b/src/pages/Ticket/locale/es.yml
@@ -100,7 +100,7 @@ weeklyTickets:
advanceTickets:
preparation: Preparación
origin: Origen
- destination: Destinatario
+ destination: Destino
originAgency: 'Agencia origen: {agency}'
destinationAgency: 'Agencia destino: {agency}'
ticketId: ID
diff --git a/src/pages/Travel/TravelFilter.vue b/src/pages/Travel/TravelFilter.vue
index 96298853f4..c911462575 100644
--- a/src/pages/Travel/TravelFilter.vue
+++ b/src/pages/Travel/TravelFilter.vue
@@ -124,6 +124,12 @@ defineExpose({ states });
lazy-rules
is-outlined
/>
+
diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue
index 05d2e5eda5..a8c0e69cbc 100644
--- a/src/pages/Travel/TravelList.vue
+++ b/src/pages/Travel/TravelList.vue
@@ -161,15 +161,6 @@ const columns = computed(() => [
cardVisible: true,
create: true,
},
- {
- align: 'left',
- name: 'daysOnward',
- label: t('travel.travelList.tableVisibleColumns.daysOnward'),
- visible: false,
- columnFilter: {
- inWhere: false,
- },
- },
{
align: 'right',
label: '',
diff --git a/src/pages/Worker/Card/WorkerCalendarFilter.vue b/src/pages/Worker/Card/WorkerCalendarFilter.vue
index 2b81b6eaf2..67b7df907b 100644
--- a/src/pages/Worker/Card/WorkerCalendarFilter.vue
+++ b/src/pages/Worker/Card/WorkerCalendarFilter.vue
@@ -3,9 +3,11 @@ import WorkerEventLabel from 'pages/Worker/Card/WorkerEventLabel.vue';
import FetchData from 'components/FetchData.vue';
import { useI18n } from 'vue-i18n';
import VnSelect from 'components/common/VnSelect.vue';
+import useNotify from 'src/composables/useNotify';
import { useRoute } from 'vue-router';
-import { computed, ref } from 'vue';
+import { computed, ref, watch } from 'vue';
import { toDateFormat } from '../../../filters/date';
+const { notify } = useNotify();
const { t } = useI18n();
const route = useRoute();
@@ -33,6 +35,13 @@ const props = defineProps({
},
});
+watch(
+ () => props.contractHolidays,
+ (newValue) => {
+ checkHolidays(newValue);
+ },
+ { deep: true, immediate: true }
+);
const emit = defineEmits(['update:businessFk', 'update:year', 'update:absenceType']);
const selectedBusinessFk = computed({
@@ -53,12 +62,22 @@ const selectedAbsenceType = computed({
},
});
-const generateYears = () => {
+function generateYears() {
const now = Date.vnNew();
const maxYear = now.getFullYear() + 1;
return Array.from({ length: 5 }, (_, i) => String(maxYear - i)) || [];
-};
+}
+
+function checkHolidays(contractHolidays) {
+ if (!contractHolidays) return;
+ if (
+ contractHolidays.holidaysEnjoyed > contractHolidays.totalHolidays ||
+ contractHolidays.hoursEnjoyed > contractHolidays.totalHours
+ ) {
+ notify(t('Vacation days have been exceeded'), 'negative');
+ }
+}
const absenceTypeList = ref([]);
const contractList = ref([]);
diff --git a/src/pages/Worker/Card/WorkerCard.vue b/src/pages/Worker/Card/WorkerCard.vue
index 5f9fa0f8e4..428731a5c2 100644
--- a/src/pages/Worker/Card/WorkerCard.vue
+++ b/src/pages/Worker/Card/WorkerCard.vue
@@ -6,7 +6,7 @@ import WorkerFilter from '../WorkerFilter.vue';
{
-
+
diff --git a/src/pages/Worker/Card/WorkerNotificationsManager.vue b/src/pages/Worker/Card/WorkerNotificationsManager.vue
index 731e073cdd..53571fb93e 100644
--- a/src/pages/Worker/Card/WorkerNotificationsManager.vue
+++ b/src/pages/Worker/Card/WorkerNotificationsManager.vue
@@ -44,8 +44,9 @@ async function toggleNotification(notification) {
`worker.notificationsManager.${notification.active ? '' : 'un'}subscribed`
),
});
- } catch {
+ } catch (e) {
notification.active = !notification.active;
+ throw e;
}
}
diff --git a/src/pages/Worker/Card/WorkerOperator.vue b/src/pages/Worker/Card/WorkerOperator.vue
new file mode 100644
index 0000000000..cdacc72c05
--- /dev/null
+++ b/src/pages/Worker/Card/WorkerOperator.vue
@@ -0,0 +1,204 @@
+
+
+
+
+ (trainsData = data)" auto-load />
+ (itemPackingTypesData = data)"
+ auto-load
+ />
+ (warehousesData = data)"
+ auto-load
+ />
+ (PrintersData = data)" auto-load />
+ (sectorsData = data)" auto-load />
+ (machinesData = data)" auto-load />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID: {{ scope.opt?.id }}
+
+ {{ scope.opt?.id }},
+ {{ scope.opt?.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+es:
+ Model: Modelo
+ Serial number: Número de serie
+ Current SIM: SIM actual
+ Add new device: Añadir nuevo dispositivo
+ PDA deallocated: PDA desasignada
+ Remove PDA: Eliminar PDA
+ Do you want to remove this PDA?: ¿Desea eliminar este PDA?
+ You can only have one PDA: Solo puedes tener un PDA si no eres autonomo
+ This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario
+
diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue
index 8fee52dd38..4a78afb52f 100644
--- a/src/pages/Worker/Card/WorkerSummary.vue
+++ b/src/pages/Worker/Card/WorkerSummary.vue
@@ -45,7 +45,7 @@ onBeforeMount(async () => {
ref="summary"
:url="`Workers/summary`"
:filter="{ where: { id: entityId } }"
- data-key="WorkerSummary"
+ data-key="Worker"
>
{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}
@@ -139,6 +139,7 @@ onBeforeMount(async () => {
+
diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue
index 9795cbed07..022cecdc6c 100644
--- a/src/pages/Worker/WorkerList.vue
+++ b/src/pages/Worker/WorkerList.vue
@@ -29,6 +29,7 @@ const postcodesOptions = ref([]);
const user = useState().getUser();
const defaultPayMethod = ref();
+const bankEntitiesRef = ref();
const columns = computed(() => [
{
align: 'left',
@@ -118,6 +119,12 @@ onBeforeMount(async () => {
).data?.payMethodFk;
});
+async function handleNewBankEntity(data, resp) {
+ await bankEntitiesRef.value.fetch();
+ data.bankEntityFk = resp.id;
+ bankEntitiesOptions.value.push(resp);
+}
+
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
data.postcode = code;
@@ -162,7 +169,7 @@ async function autofillBic(worker) {
@@ -177,19 +184,20 @@ async function autofillBic(worker) {
auto-load
/>
(bankEntitiesOptions = data)"
auto-load
/>
-
+
bankEntitiesOptions.push(data)"
+ @on-data-saved="
+ (_, resp) => handleNewBankEntity(data, resp)
+ "
/>
diff --git a/src/pages/Worker/locale/en.yml b/src/pages/Worker/locale/en.yml
index 865e86e7ea..8276977fde 100644
--- a/src/pages/Worker/locale/en.yml
+++ b/src/pages/Worker/locale/en.yml
@@ -9,3 +9,4 @@ tableColumns:
fi: FI
SSN: SSN
extension: Extension
+queue: Queue
diff --git a/src/pages/Worker/locale/es.yml b/src/pages/Worker/locale/es.yml
index b3c093ec52..9c7618bc32 100644
--- a/src/pages/Worker/locale/es.yml
+++ b/src/pages/Worker/locale/es.yml
@@ -14,3 +14,4 @@ tableColumns:
fi: NIF
SSN: NSS
extension: Extensión
+queue: Cola
diff --git a/src/pages/Zone/Card/ZoneWarehouses.vue b/src/pages/Zone/Card/ZoneWarehouses.vue
index 6b29332243..98e4467971 100644
--- a/src/pages/Zone/Card/ZoneWarehouses.vue
+++ b/src/pages/Zone/Card/ZoneWarehouses.vue
@@ -34,21 +34,13 @@ const columns = computed(() => [
]);
const deleteWarehouse = async (row) => {
- try {
- await axios.delete(`${urlPath.value}/${row.id}`);
- fetchWarehouses();
- } catch (error) {
- console.error(error);
- }
+ await axios.delete(`${urlPath.value}/${row.id}`);
+ fetchWarehouses();
};
const createZoneWarehouse = async (ZoneWarehouseFormData) => {
- try {
- await axios.post(urlPath.value, ZoneWarehouseFormData);
- fetchWarehouses();
- } catch (error) {
- console.error(error);
- }
+ await axios.post(urlPath.value, ZoneWarehouseFormData);
+ fetchWarehouses();
};
watch(
diff --git a/src/pages/Zone/ZoneDeliveryPanel.vue b/src/pages/Zone/ZoneDeliveryPanel.vue
index 088811b013..423095d6ed 100644
--- a/src/pages/Zone/ZoneDeliveryPanel.vue
+++ b/src/pages/Zone/ZoneDeliveryPanel.vue
@@ -94,9 +94,9 @@ watch(
url="Postcodes/location"
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
sort-by="code, townFk"
- option-value="code"
+ option-value="geoFk"
option-label="code"
- option-filter="code"
+ :filter-options="['code', 'geoFk']"
hide-selected
dense
outlined
diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue
index d160ea6b57..89f2dd42cc 100644
--- a/src/pages/Zone/ZoneList.vue
+++ b/src/pages/Zone/ZoneList.vue
@@ -103,7 +103,7 @@ const columns = computed(() => [
name: 'tableActions',
actions: [
{
- title: t('list.zoneSummary'),
+ title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ZoneSummary),
isPrimary: true,
diff --git a/src/router/modules/entry.js b/src/router/modules/entry.js
index 4750a4301a..3add239df6 100644
--- a/src/router/modules/entry.js
+++ b/src/router/modules/entry.js
@@ -12,7 +12,13 @@ export default {
component: RouterView,
redirect: { name: 'EntryMain' },
menus: {
- main: ['EntryList', 'MyEntries', 'EntryLatestBuys', 'EntryStockBought'],
+ main: [
+ 'EntryList',
+ 'MyEntries',
+ 'EntryLatestBuys',
+ 'EntryStockBought',
+ 'EntryWasteRecalc',
+ ],
card: ['EntryBasicData', 'EntryBuys', 'EntryNotes', 'EntryDms', 'EntryLog'],
},
children: [
@@ -67,6 +73,15 @@ export default {
},
component: () => import('src/pages/Entry/EntryStockBought.vue'),
},
+ {
+ path: 'waste-recalc',
+ name: 'EntryWasteRecalc',
+ meta: {
+ title: 'wasteRecalc',
+ icon: 'compost',
+ },
+ component: () => import('src/pages/Entry/EntryWasteRecalc.vue'),
+ },
],
},
{
diff --git a/src/router/modules/item.js b/src/router/modules/item.js
index 48e19dd54e..2838c3be7c 100644
--- a/src/router/modules/item.js
+++ b/src/router/modules/item.js
@@ -48,6 +48,28 @@ export default {
},
component: () => import('src/pages/Item/ItemList.vue'),
},
+ {
+ path: 'request',
+ name: 'ItemRequest',
+ meta: {
+ title: 'buyRequest',
+ icon: 'vn:buyrequest',
+ },
+ component: () => import('src/pages/Item/ItemRequest.vue'),
+ },
+ {
+ path: 'waste-breakdown',
+ name: 'WasteBreakdown',
+ meta: {
+ title: 'wasteBreakdown',
+ icon: 'vn:claims',
+ },
+ beforeEnter: (to, from, next) => {
+ next({ name: 'ItemList' });
+ window.location.href =
+ 'https://grafana.verdnatura.es/d/TTNXQAxVk';
+ },
+ },
{
path: 'fixed-price',
name: 'ItemFixedPrice',
@@ -65,19 +87,7 @@ export default {
},
component: () => import('src/pages/Item/ItemCreate.vue'),
},
- {
- path: 'waste-breakdown',
- name: 'WasteBreakdown',
- meta: {
- title: 'wasteBreakdown',
- icon: 'vn:claims',
- },
- beforeEnter: (to, from, next) => {
- next({ name: 'ItemList' });
- window.location.href =
- 'https://grafana.verdnatura.es/d/TTNXQAxVk';
- },
- },
+
{
path: 'item-type-list',
name: 'ItemTypeList',
@@ -95,15 +105,6 @@ export default {
},
component: () => import('src/pages/Item/ItemTypeCreate.vue'),
},
- {
- path: 'request',
- name: 'ItemRequest',
- meta: {
- title: 'buyRequest',
- icon: 'vn:buyrequest',
- },
- component: () => import('src/pages/Item/ItemRequest.vue'),
- },
],
},
{
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index 7258881be2..c2a9e668fb 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -27,6 +27,7 @@ export default {
'WorkerBalance',
'WorkerFormation',
'WorkerMedical',
+ 'WorkerOperator',
],
},
children: [
@@ -208,6 +209,15 @@ export default {
},
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
},
+ {
+ name: 'WorkerOperator',
+ path: 'operator',
+ meta: {
+ title: 'operator',
+ icon: 'person',
+ },
+ component: () => import('src/pages/Worker/Card/WorkerOperator.vue'),
+ },
],
},
],
diff --git a/src/stores/useStateQueryStore.js b/src/stores/useStateQueryStore.js
new file mode 100644
index 0000000000..d25dbb9215
--- /dev/null
+++ b/src/stores/useStateQueryStore.js
@@ -0,0 +1,31 @@
+import { ref, computed } from 'vue';
+import { defineStore } from 'pinia';
+
+export const useStateQueryStore = defineStore('stateQueryStore', () => {
+ const queries = ref(new Set());
+
+ function add(query) {
+ queries.value.add(query);
+ return query;
+ }
+
+ function isLoading() {
+ return computed(() => queries.value.size);
+ }
+
+ function remove(query) {
+ queries.value.delete(query);
+ }
+
+ function reset() {
+ queries.value = new Set();
+ }
+
+ return {
+ add,
+ isLoading,
+ remove,
+ queries,
+ reset,
+ };
+});
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index 81fc33ecd0..eb39f340a7 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -33,7 +33,8 @@ describe('ClaimDevelopment', () => {
cy.saveCard();
});
- it('should add and remove new line', () => {
+ // TODO: #8112
+ xit('should add and remove new line', () => {
cy.wait(['@workers', '@workers']);
cy.addCard();
diff --git a/test/cypress/integration/claim/claimNotes.spec.js b/test/cypress/integration/claim/claimNotes.spec.js
index a4a493cda7..d7a918db1b 100644
--- a/test/cypress/integration/claim/claimNotes.spec.js
+++ b/test/cypress/integration/claim/claimNotes.spec.js
@@ -1,4 +1,6 @@
describe('ClaimNotes', () => {
+ const saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon';
+ const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/claim/${2}/notes`);
@@ -7,7 +9,7 @@ describe('ClaimNotes', () => {
it('should add a new note', () => {
const message = 'This is a new message.';
cy.get('.q-textarea').type(message);
- cy.get('.q-field__append > .q-btn > .q-btn__content > .q-icon').click(); //save
- cy.get(':nth-child(1) > .q-card__section--vert').should('have.text', message);
+ cy.get(saveBtn).click();
+ cy.get(firstNote).should('have.text', message);
});
});
diff --git a/test/cypress/integration/client/clientAddress.spec.js b/test/cypress/integration/client/clientAddress.spec.js
new file mode 100644
index 0000000000..db876b64bb
--- /dev/null
+++ b/test/cypress/integration/client/clientAddress.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client consignee', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/address', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientBalance.spec.js b/test/cypress/integration/client/clientBalance.spec.js
new file mode 100644
index 0000000000..dfba56b16f
--- /dev/null
+++ b/test/cypress/integration/client/clientBalance.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client balance', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/balance', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientBasicData.spec.js b/test/cypress/integration/client/clientBasicData.spec.js
new file mode 100644
index 0000000000..7b0a198280
--- /dev/null
+++ b/test/cypress/integration/client/clientBasicData.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client basic data', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/basic-data', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientBillingData.spec.js b/test/cypress/integration/client/clientBillingData.spec.js
new file mode 100644
index 0000000000..00af82e399
--- /dev/null
+++ b/test/cypress/integration/client/clientBillingData.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client billing data', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/billing-data', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientCredits.spec.js b/test/cypress/integration/client/clientCredits.spec.js
new file mode 100644
index 0000000000..5f303b40d3
--- /dev/null
+++ b/test/cypress/integration/client/clientCredits.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client credits', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/credits', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientFiscalData.spec.js b/test/cypress/integration/client/clientFiscalData.spec.js
new file mode 100644
index 0000000000..e337c26f8b
--- /dev/null
+++ b/test/cypress/integration/client/clientFiscalData.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client fiscal data', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/fiscal-data', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientGreuges.spec.js b/test/cypress/integration/client/clientGreuges.spec.js
new file mode 100644
index 0000000000..23f8b31823
--- /dev/null
+++ b/test/cypress/integration/client/clientGreuges.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client greuges', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/greuges', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js
new file mode 100644
index 0000000000..22bca15acb
--- /dev/null
+++ b/test/cypress/integration/client/clientList.spec.js
@@ -0,0 +1,46 @@
+///
+describe('Client list', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('/#/customer/list', {
+ timeout: 5000,
+ onBeforeLoad(win) {
+ cy.stub(win, 'open');
+ },
+ });
+ });
+
+ it('Client list create new client', () => {
+ cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ const data = {
+ Name: { val: 'Name 1' },
+ 'Social name': { val: 'TEST 1' },
+ 'Tax number': { val: '20852113Z' },
+ 'Web user': { val: 'user_test_1' },
+ Street: { val: 'C/ STREET 1' },
+ Email: { val: 'user.test@1.com' },
+ 'Business type': { val: 'Otros', type: 'select' },
+ 'Sales person': { val: 'salesboss', type: 'select' },
+ Location: { val: '46000, Valencia(Province one), España', type: 'select' },
+ };
+ cy.fillInForm(data);
+
+ cy.get('.q-mt-lg > .q-btn--standard').click();
+
+ cy.checkNotification('Data created');
+ cy.url().should('include', '/summary');
+ });
+ it('Client list search client', () => {
+ const search = 'Jessica Jones';
+ cy.searchByLabel('Name', search);
+
+ cy.get('.title > span').should('have.text', search);
+ let id = null;
+ cy.get('.q-item > .q-item__label').then((text) => {
+ id = text.text().trim().split('#')[1];
+ cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
+ cy.url().should('include', `/customer/${id}/summary`);
+ });
+ });
+});
diff --git a/test/cypress/integration/client/clientNotes.spec.js b/test/cypress/integration/client/clientNotes.spec.js
new file mode 100644
index 0000000000..99a7c66c5a
--- /dev/null
+++ b/test/cypress/integration/client/clientNotes.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client notes', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/notes', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientRecoveries.spec.js b/test/cypress/integration/client/clientRecoveries.spec.js
new file mode 100644
index 0000000000..ea6f144074
--- /dev/null
+++ b/test/cypress/integration/client/clientRecoveries.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client recoveries', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/recoveries', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/clientWebAccess.spec.js b/test/cypress/integration/client/clientWebAccess.spec.js
new file mode 100644
index 0000000000..47f9efa4c5
--- /dev/null
+++ b/test/cypress/integration/client/clientWebAccess.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client web-access', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/web-access', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/credit-management/clientCreditContracts.spec.js b/test/cypress/integration/client/credit-management/clientCreditContracts.spec.js
new file mode 100644
index 0000000000..3c35d5ed0a
--- /dev/null
+++ b/test/cypress/integration/client/credit-management/clientCreditContracts.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client credit opinion', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/credit-management/credit-contracts', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/credit-management/clientCreditOpinion.spec.js b/test/cypress/integration/client/credit-management/clientCreditOpinion.spec.js
new file mode 100644
index 0000000000..c32215f014
--- /dev/null
+++ b/test/cypress/integration/client/credit-management/clientCreditOpinion.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client credit opinion', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/credit-management/credit-opinion', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientConsumption.spec.js b/test/cypress/integration/client/others/clientConsumption.spec.js
new file mode 100644
index 0000000000..bbc11998ee
--- /dev/null
+++ b/test/cypress/integration/client/others/clientConsumption.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client consumption', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/consumption', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientContacts.spec.js b/test/cypress/integration/client/others/clientContacts.spec.js
new file mode 100644
index 0000000000..66a86801a0
--- /dev/null
+++ b/test/cypress/integration/client/others/clientContacts.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client contacts', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/contacts', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientMandates.spec.js b/test/cypress/integration/client/others/clientMandates.spec.js
new file mode 100644
index 0000000000..055eda2d05
--- /dev/null
+++ b/test/cypress/integration/client/others/clientMandates.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client mandates', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/others/mandates', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientSamples.spec.js b/test/cypress/integration/client/others/clientSamples.spec.js
new file mode 100644
index 0000000000..a50120402b
--- /dev/null
+++ b/test/cypress/integration/client/others/clientSamples.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client samples', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/samples', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientUnpaid.spec.js b/test/cypress/integration/client/others/clientUnpaid.spec.js
new file mode 100644
index 0000000000..9972ba0e94
--- /dev/null
+++ b/test/cypress/integration/client/others/clientUnpaid.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client unpaid', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1110/others/unpaid', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-card').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/client/others/clientWebPayments.spec.js b/test/cypress/integration/client/others/clientWebPayments.spec.js
new file mode 100644
index 0000000000..f35b126124
--- /dev/null
+++ b/test/cypress/integration/client/others/clientWebPayments.spec.js
@@ -0,0 +1,13 @@
+///
+describe('Client web payments', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('#/customer/1101/others/web-payment', {
+ timeout: 5000,
+ });
+ });
+ it('Should load layout', () => {
+ cy.get('.q-page').should('be.visible');
+ });
+});
diff --git a/test/cypress/integration/entry/myEntry.spec.js b/test/cypress/integration/entry/myEntry.spec.js
index dca74dec2a..4addec1c45 100644
--- a/test/cypress/integration/entry/myEntry.spec.js
+++ b/test/cypress/integration/entry/myEntry.spec.js
@@ -11,7 +11,7 @@ describe('EntryMy when is supplier', () => {
it('should open buyLabel when is supplier', () => {
cy.get(
- '[to="/null/2"] > .q-card > .column > .q-btn > .q-btn__content > .q-icon'
+ '[to="/null/3"] > .q-card > .column > .q-btn > .q-btn__content > .q-icon'
).click();
cy.get('.q-card__actions > .q-btn').click();
cy.window().its('open').should('be.called');
diff --git a/test/cypress/integration/outLogin/logout.spec.js b/test/cypress/integration/outLogin/logout.spec.js
index 4231899088..8d4e90aacb 100644
--- a/test/cypress/integration/outLogin/logout.spec.js
+++ b/test/cypress/integration/outLogin/logout.spec.js
@@ -13,7 +13,7 @@ describe('Logout', () => {
});
describe('not user', () => {
beforeEach(() => {
- cy.intercept('GET', '**/VnUsers/acl', {
+ cy.intercept('GET', '**DefaultViewConfigs**', {
statusCode: 401,
body: {
error: {
@@ -24,10 +24,11 @@ describe('Logout', () => {
},
},
statusMessage: 'AUTHORIZATION_REQUIRED',
- }).as('someRoute');
+ });
});
+
it('when token not exists', () => {
- cy.reload();
+ cy.get('.q-list > [href="#/item"]').click();
cy.get('.q-notification__message').should(
'have.text',
'Authorization Required'
diff --git a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
index 353c5805b7..fdfcd4286e 100644
--- a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
+++ b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
@@ -7,31 +7,20 @@ describe('AgencyWorkCenter', () => {
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
const workCenterCombobox = 'input[role="combobox"]';
- it('assign workCenter', () => {
+ it('check workCenter crud', () => {
+ // create
cy.get(createButton).click();
cy.get(workCenterCombobox).type('workCenterOne{enter}');
- cy.get('.q-notification__message').should('have.text', 'Data created');
- });
+ cy.checkNotification('Data created');
- it('delete workCenter', () => {
+ // expect error when duplicate
+ cy.get(createButton).click();
+ cy.get('[data-cy="FormModelPopup_save"]').click();
+ cy.checkNotification('This workCenter is already assigned to this agency');
+ cy.get('[data-cy="FormModelPopup_cancel"]').click();
+
+ // delete
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
- cy.get('.q-notification__message').should(
- 'have.text',
- 'WorkCenter removed successfully'
- );
- });
-
- it('error on duplicate workCenter', () => {
- cy.get(createButton).click();
- cy.get(workCenterCombobox).type('workCenterOne{enter}');
- cy.get('.q-notification__message').should('have.text', 'Data created');
- cy.get(createButton).click();
- cy.get(
- '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
- ).type('workCenterOne{enter}');
-
- cy.get(
- ':nth-child(2) > .q-notification__wrapper > .q-notification__content > .q-notification__message'
- ).should('have.text', 'This workCenter is already assigned to this agency');
+ cy.checkNotification('WorkCenter removed successfully');
});
});
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index 8192b7c7ca..0ba2723a25 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -1,7 +1,8 @@
///
describe('Ticket descriptor', () => {
- const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
- const setWeightOpt = '[role="menu"] .q-list > :nth-child(6)';
+ const listItem = '[role="menu"] .q-list .q-item';
+ const toCloneOpt = 'To clone ticket';
+ const setWeightOpt = 'Set weight';
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
const summaryHeader = '.summaryHeader > div';
const weight = 25;
@@ -14,7 +15,7 @@ describe('Ticket descriptor', () => {
it('should clone the ticket without warehouse', () => {
cy.visit('/#/ticket/1/summary');
cy.openActionsDescriptor();
- cy.get(toCloneOpt).click();
+ cy.contains(listItem, toCloneOpt).click();
cy.clickConfirm();
cy.get(warehouseValue).contains('Warehouse One');
cy.get(summaryHeader)
@@ -28,7 +29,7 @@ describe('Ticket descriptor', () => {
it('should set the weight of the ticket', () => {
cy.visit('/#/ticket/10/summary');
cy.openActionsDescriptor();
- cy.get(setWeightOpt).click();
+ cy.contains(listItem, setWeightOpt).click();
cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');
cy.get('.q-dialog input').type(weight);
cy.clickConfirm();
diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js
new file mode 100644
index 0000000000..5eb2c1a2ae
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketExpedition.spec.js
@@ -0,0 +1,28 @@
+///
+
+describe('Ticket expedtion', () => {
+ const tableContent = '.q-table .q-virtual-scroll__content';
+ const stateTd = 'td:nth-child(9)';
+
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ });
+
+ it('should change the state', () => {
+ cy.visit('#/ticket/1/expedition');
+ cy.intercept('GET', /\/api\/Expeditions\/filter/).as('expeditions');
+ cy.intercept('POST', /\/api\/Expeditions\/crud/).as('crud');
+
+ cy.wait('@expeditions');
+
+ cy.selectRows([1, 2]);
+ cy.get('#subToolbar [aria-controls]:nth-child(1)').click();
+ cy.get('.q-menu .q-item').contains('Perdida').click();
+ cy.wait('@crud');
+
+ cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
+ cy.wrap($el).contains('Perdida');
+ });
+ });
+});
diff --git a/test/cypress/integration/vnComponent/vnLocation.spec.js b/test/cypress/integration/vnComponent/vnLocation.spec.js
index 78dc38899a..c1b0cf9297 100644
--- a/test/cypress/integration/vnComponent/vnLocation.spec.js
+++ b/test/cypress/integration/vnComponent/vnLocation.spec.js
@@ -64,7 +64,7 @@ describe('VnLocation', () => {
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) > .q-icon`
).click();
cy.get(
- `#q-portal--dialog--4 > .q-dialog > ${createForm.prefix} > .vn-row > .q-select > ${createForm.sufix} > :nth-child(1) input`
+ `#q-portal--dialog--5 > .q-dialog > ${createForm.prefix} > .vn-row > .q-select > ${createForm.sufix} > :nth-child(1) input`
).should('have.value', province);
});
});
@@ -133,6 +133,8 @@ describe('VnLocation', () => {
);
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(`${createForm.prefix}`).should('not.exist');
+ cy.waitForElement('.q-form');
+
checkVnLocation(postCode, province);
});
it('Create city', () => {
@@ -144,10 +146,12 @@ describe('VnLocation', () => {
cy.get(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
).click();
- cy.selectOption('#q-portal--dialog--2 .q-select', 'one');
- cy.get('#q-portal--dialog--2 .q-input').type(province);
- cy.get('#q-portal--dialog--2 .q-btn--standard').click();
+ cy.selectOption('#q-portal--dialog--3 .q-select', 'one');
+ cy.get('#q-portal--dialog--3 .q-input').type(province);
+ cy.get('#q-portal--dialog--3 .q-btn--standard').click();
cy.get('#q-portal--dialog--1 .q-btn--standard').click();
+ cy.waitForElement('.q-form');
+
checkVnLocation(postCode, province);
});
diff --git a/test/cypress/integration/worker/workerNotificationsManager.spec.js b/test/cypress/integration/worker/workerNotificationsManager.spec.js
index ac452c4ff8..f121b3894f 100644
--- a/test/cypress/integration/worker/workerNotificationsManager.spec.js
+++ b/test/cypress/integration/worker/workerNotificationsManager.spec.js
@@ -17,8 +17,7 @@ describe('WorkerNotificationsManager', () => {
cy.login('developer');
cy.visit(`/#/worker/${salesPersonId}/notifications`);
cy.get(firstAvailableNotification).click();
- cy.notificationHas(
- '.q-notification__message',
+ cy.checkNotification(
'The notification subscription of this worker cant be modified'
);
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 83f45b7211..c9b1a748e8 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -152,6 +152,14 @@ Cypress.Commands.add('notificationHas', (selector, text) => {
cy.get(selector).should('have.text', text);
});
+Cypress.Commands.add('selectRows', (rows) => {
+ rows.forEach((row) => {
+ cy.get('.q-table .q-virtual-scroll__content tr .q-checkbox__inner')
+ .eq(row - 1)
+ .click();
+ });
+});
+
Cypress.Commands.add('fillRow', (rowSelector, data) => {
// Usar el selector proporcionado para obtener la fila deseada
cy.waitForElement('tbody');
@@ -245,6 +253,13 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => {
cy.get(selector).should('have.text', expectedValue);
});
+Cypress.Commands.add('openActionDescriptor', (opt) => {
+ cy.openActionsDescriptor();
+ const listItem = '[role="menu"] .q-list .q-item';
+ cy.contains(listItem, opt).click();
+ 1;
+});
+
Cypress.Commands.add('openActionsDescriptor', () => {
cy.get('.header > :nth-child(3) > .q-btn__content > .q-icon').click();
});
@@ -254,3 +269,21 @@ Cypress.Commands.add('openUserPanel', () => {
'.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image'
).click();
});
+
+Cypress.Commands.add('openActions', (row) => {
+ cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
+});
+
+Cypress.Commands.add('checkNotification', (text) => {
+ cy.get('.q-notification')
+ .should('be.visible')
+ .last()
+ .then(($lastNotification) => {
+ if (!Cypress.$($lastNotification).text().includes(text))
+ throw new Error(`Notification not found: "${text}"`);
+ });
+});
+
+Cypress.Commands.add('searchByLabel', (label, value) => {
+ cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
+});
diff --git a/test/vitest/__tests__/boot/axios.spec.js b/test/vitest/__tests__/boot/axios.spec.js
index feb0d93ea7..19d396ec52 100644
--- a/test/vitest/__tests__/boot/axios.spec.js
+++ b/test/vitest/__tests__/boot/axios.spec.js
@@ -7,75 +7,59 @@ vi.mock('src/composables/useSession', () => ({
getToken: () => 'DEFAULT_TOKEN',
isLoggedIn: () => vi.fn(),
destroy: () => vi.fn(),
- })
+ }),
+}));
+
+vi.mock('src/stores/useStateQueryStore', () => ({
+ useStateQueryStore: () => ({
+ add: () => vi.fn(),
+ remove: () => vi.fn(),
+ }),
}));
describe('Axios boot', () => {
-
describe('onRequest()', async () => {
it('should set the "Authorization" property on the headers', async () => {
const config = { headers: {} };
const resultConfig = onRequest(config);
- expect(resultConfig).toEqual(expect.objectContaining({
- headers: {
- Authorization: 'DEFAULT_TOKEN'
- }
- }));
- });
- })
-
- describe('onResponseError()', async () => {
- it('should call to the Notify plugin with a message error for an status code "500"', async () => {
- Notify.create = vi.fn()
-
- const error = {
- response: {
- status: 500
- }
- };
-
- const result = onResponseError(error);
-
-
- expect(result).rejects.toEqual(
- expect.objectContaining(error)
- );
- expect(Notify.create).toHaveBeenCalledWith(
+ expect(resultConfig).toEqual(
expect.objectContaining({
- message: 'An internal server error has ocurred',
- type: 'negative',
+ headers: {
+ Authorization: 'DEFAULT_TOKEN',
+ },
})
);
});
+ });
+
+ describe('onResponseError()', async () => {
+ it('should call to the Notify plugin with a message error for an status code "500"', async () => {
+ const error = {
+ response: {
+ status: 500,
+ },
+ };
+
+ const result = onResponseError(error);
+ expect(result).rejects.toEqual(expect.objectContaining(error));
+ });
it('should call to the Notify plugin with a message from the response property', async () => {
- Notify.create = vi.fn()
-
const error = {
response: {
status: 401,
data: {
error: {
- message: 'Invalid user or password'
- }
- }
- }
+ message: 'Invalid user or password',
+ },
+ },
+ },
};
const result = onResponseError(error);
-
-
- expect(result).rejects.toEqual(
- expect.objectContaining(error)
- );
- expect(Notify.create).toHaveBeenCalledWith(
- expect.objectContaining({
- message: 'Invalid user or password',
- type: 'negative',
- })
- );
+ expect(result).rejects.toEqual(expect.objectContaining(error));
});
- })
+ });
});
diff --git a/test/vitest/__tests__/stores/useStateQueryStore.spec.js b/test/vitest/__tests__/stores/useStateQueryStore.spec.js
new file mode 100644
index 0000000000..ab3afb007d
--- /dev/null
+++ b/test/vitest/__tests__/stores/useStateQueryStore.spec.js
@@ -0,0 +1,58 @@
+import { describe, expect, it, beforeEach, beforeAll } from 'vitest';
+import { createWrapper } from 'app/test/vitest/helper';
+
+import { useStateQueryStore } from 'src/stores/useStateQueryStore';
+
+describe('useStateQueryStore', () => {
+ beforeAll(() => {
+ createWrapper({}, {});
+ });
+
+ const stateQueryStore = useStateQueryStore();
+ const { add, isLoading, remove, reset } = useStateQueryStore();
+ const firstQuery = { url: 'myQuery' };
+
+ function getQueries() {
+ return stateQueryStore.queries;
+ }
+
+ beforeEach(() => {
+ reset();
+ expect(getQueries().size).toBeFalsy();
+ });
+
+ it('should add two queries', async () => {
+ expect(getQueries().size).toBeFalsy();
+ add(firstQuery);
+
+ expect(getQueries().size).toBeTruthy();
+ expect(getQueries().has(firstQuery)).toBeTruthy();
+
+ add();
+ expect(getQueries().size).toBe(2);
+ });
+
+ it('should add and remove loading state', async () => {
+ expect(isLoading().value).toBeFalsy();
+ add(firstQuery);
+ expect(isLoading().value).toBeTruthy();
+ remove(firstQuery);
+ expect(isLoading().value).toBeFalsy();
+ });
+
+ it('should add and remove query', async () => {
+ const secondQuery = { ...firstQuery };
+ const thirdQuery = { ...firstQuery };
+
+ add(firstQuery);
+ add(secondQuery);
+
+ const beforeCount = getQueries().size;
+ add(thirdQuery);
+ expect(getQueries().has(thirdQuery)).toBeTruthy();
+
+ remove(thirdQuery);
+ expect(getQueries().has(thirdQuery)).toBeFalsy();
+ expect(getQueries().size).toBe(beforeCount);
+ });
+});