diff --git a/src/components/common/VnModule.vue b/src/components/common/VnModule.vue
index 038ee1d60..747a7c951 100644
--- a/src/components/common/VnModule.vue
+++ b/src/components/common/VnModule.vue
@@ -12,7 +12,7 @@ const $props = defineProps({
},
});
onMounted(
- () => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
+ () => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false),
);
const teleportRef = ref({});
@@ -35,8 +35,14 @@ onMounted(() => {
-
-
+
+
+
+
+
+
+
+
diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue
index d111780bd..339f90e0e 100644
--- a/src/components/common/VnSelect.vue
+++ b/src/components/common/VnSelect.vue
@@ -302,6 +302,8 @@ defineExpose({ opts: myOptions, vnSelectRef });
function handleKeyDown(event) {
if (event.key === 'Tab' && !event.shiftKey) {
+ event.preventDefault();
+
const inputValue = vnSelectRef.value?.inputValue;
if (inputValue) {
diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue
index ec6289a67..eb0804af0 100644
--- a/src/components/ui/VnNotes.vue
+++ b/src/components/ui/VnNotes.vue
@@ -18,20 +18,16 @@ import VnInput from 'components/common/VnInput.vue';
const emit = defineEmits(['onFetch']);
-const originalAttrs = useAttrs();
-
-const $attrs = computed(() => {
- const { style, ...rest } = originalAttrs;
- return rest;
-});
+const $attrs = useAttrs();
const isRequired = computed(() => {
- return Object.keys($attrs).includes('required')
+ return Object.keys($attrs).includes('required');
});
const $props = defineProps({
url: { type: String, default: null },
- saveUrl: {type: String, default: null},
+ saveUrl: { type: String, default: null },
+ userFilter: { type: Object, default: () => {} },
filter: { type: Object, default: () => {} },
body: { type: Object, default: () => {} },
addNote: { type: Boolean, default: false },
@@ -65,7 +61,7 @@ async function insert() {
}
function confirmAndUpdate() {
- if(!newNote.text && originalText)
+ if (!newNote.text && originalText)
quasar
.dialog({
component: VnConfirm,
@@ -88,11 +84,17 @@ async function update() {
...body,
...{ notes: newNote.text },
};
- await axios.patch(`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`, newBody);
+ await axios.patch(
+ `${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`,
+ newBody,
+ );
}
onBeforeRouteLeave((to, from, next) => {
- if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
+ if (
+ (newNote.text && !$props.justInput) ||
+ (newNote.text !== originalText && $props.justInput)
+ )
quasar.dialog({
component: VnConfirm,
componentProps: {
@@ -104,12 +106,11 @@ onBeforeRouteLeave((to, from, next) => {
else next();
});
-function fetchData([ data ]) {
+function fetchData([data]) {
newNote.text = data?.notes;
originalText = data?.notes;
emit('onFetch', data);
}
-
-
@@ -179,7 +180,8 @@ function fetchData([ data ]) {
:url="$props.url"
order="created DESC"
:limit="0"
- :user-filter="$props.filter"
+ :user-filter="userFilter"
+ :filter="filter"
auto-load
ref="vnPaginateRef"
class="show"
@@ -218,7 +220,7 @@ function fetchData([ data ]) {
>
{{
observationTypes.find(
- (ot) => ot.id === note.observationTypeFk
+ (ot) => ot.id === note.observationTypeFk,
)?.description
}}
diff --git a/src/pages/Claim/Card/ClaimNotes.vue b/src/pages/Claim/Card/ClaimNotes.vue
index cc6e33779..68cb220ee 100644
--- a/src/pages/Claim/Card/ClaimNotes.vue
+++ b/src/pages/Claim/Card/ClaimNotes.vue
@@ -1,5 +1,5 @@
-
diff --git a/src/pages/Customer/Card/CustomerSummary.vue b/src/pages/Customer/Card/CustomerSummary.vue
index 558d09b93..7d5d691a3 100644
--- a/src/pages/Customer/Card/CustomerSummary.vue
+++ b/src/pages/Customer/Card/CustomerSummary.vue
@@ -322,7 +322,7 @@ const sumRisk = ({ clientRisks }) => {
-
+
diff --git a/src/pages/Customer/components/CustomerSummaryTable.vue b/src/pages/Customer/components/CustomerSummaryTable.vue
index bb6f4442b..09c7e714c 100644
--- a/src/pages/Customer/components/CustomerSummaryTable.vue
+++ b/src/pages/Customer/components/CustomerSummaryTable.vue
@@ -20,7 +20,12 @@ const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const { viewSummary } = useSummaryDialog();
-
+const $props = defineProps({
+ id: {
+ type: Number,
+ default: null,
+ },
+});
const filter = {
include: [
{
@@ -43,7 +48,7 @@ const filter = {
},
},
],
- where: { clientFk: route.params.id },
+ where: { clientFk: $props.id ?? route.params.id },
order: ['shipped DESC', 'id'],
limit: 30,
};
diff --git a/src/pages/Customer/composables/__tests__/getAddresses.spec.js b/src/pages/Customer/composables/__tests__/getAddresses.spec.js
index 9e04a83cc..8c90bf281 100644
--- a/src/pages/Customer/composables/__tests__/getAddresses.spec.js
+++ b/src/pages/Customer/composables/__tests__/getAddresses.spec.js
@@ -17,9 +17,9 @@ describe('getAddresses', () => {
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
params: {
filter: JSON.stringify({
- fields: ['nickname', 'street', 'city', 'id'],
+ fields: ['nickname', 'street', 'city', 'id', 'isActive'],
where: { isActive: true },
- order: 'nickname ASC',
+ order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
}),
},
});
@@ -30,4 +30,4 @@ describe('getAddresses', () => {
expect(axios.get).not.toHaveBeenCalled();
});
-});
\ No newline at end of file
+});
diff --git a/src/pages/Customer/composables/getAddresses.js b/src/pages/Customer/composables/getAddresses.js
index e65e64455..5f18530e7 100644
--- a/src/pages/Customer/composables/getAddresses.js
+++ b/src/pages/Customer/composables/getAddresses.js
@@ -1,15 +1,15 @@
import axios from 'axios';
-export async function getAddresses(clientId, _filter = {}) {
+export async function getAddresses(clientId, _filter = {}) {
if (!clientId) return;
const filter = {
..._filter,
- fields: ['nickname', 'street', 'city', 'id'],
+ fields: ['nickname', 'street', 'city', 'id', 'isActive'],
where: { isActive: true },
- order: 'nickname ASC',
+ order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
};
const params = { filter: JSON.stringify(filter) };
return await axios.get(`Clients/${clientId}/addresses`, {
params,
});
-};
\ No newline at end of file
+}
diff --git a/src/pages/Entry/Card/EntryBuys.vue b/src/pages/Entry/Card/EntryBuys.vue
index 6e67c31ed..684ed5f59 100644
--- a/src/pages/Entry/Card/EntryBuys.vue
+++ b/src/pages/Entry/Card/EntryBuys.vue
@@ -656,7 +656,6 @@ onMounted(() => {
:without-header="!editableMode"
:with-filters="editableMode"
:right-search="editableMode"
- :right-search-icon="true"
:row-click="false"
:columns="columns"
:beforeSaveFn="beforeSave"
diff --git a/src/pages/Item/Card/ItemDiary.vue b/src/pages/Item/Card/ItemDiary.vue
index 83cd562a0..f839c1f71 100644
--- a/src/pages/Item/Card/ItemDiary.vue
+++ b/src/pages/Item/Card/ItemDiary.vue
@@ -158,15 +158,10 @@ const getBadgeAttrs = (_date) => {
const scrollToToday = async () => {
await nextTick();
- const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`);
- if (todayCell) {
- todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
- }
-};
-
-const formatDateForAttribute = (dateValue) => {
- if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD');
- return dateValue;
+ const todayCell = document.querySelector(
+ `td[data-date="${date.formatDate(today, 'YYYY-MM-DD')}"]`,
+ );
+ if (todayCell) todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
};
async function updateWarehouse(warehouseFk) {
@@ -242,7 +237,7 @@ async function updateWarehouse(warehouseFk) {
-
+
{
+onMounted(async () => {
stateStore.rightDrawer = true;
checkOrderConfirmation();
+
+ if (
+ arrayData.store.userParams &&
+ Object.keys(arrayData.store.userParams).some((key) => !key.startsWith('order'))
+ ) {
+ await arrayData.fetch({});
+ }
});
+onUnmounted(() => {
+ arrayData.destroy();
+});
+
+function exprBuilder(param, value) {
+ switch (param) {
+ case 'categoryFk':
+ case 'typeFk':
+ return { [param]: value };
+ case 'search':
+ if (/^\d+$/.test(value)) return { 'i.id': value };
+ else return { 'i.name': { like: `%${value}%` } };
+ }
+}
+
async function checkOrderConfirmation() {
const response = await axios.get(`Orders/${route.params.id}`);
if (response.data.isConfirmed === 1) {
@@ -96,6 +121,7 @@ watch(
:tag-value="tagValue"
:tags="tags"
:initial-catalog-params="catalogParams"
+ :arrayData
/>
diff --git a/src/pages/Order/Card/OrderCatalogFilter.vue b/src/pages/Order/Card/OrderCatalogFilter.vue
index 76e608983..d16a92017 100644
--- a/src/pages/Order/Card/OrderCatalogFilter.vue
+++ b/src/pages/Order/Card/OrderCatalogFilter.vue
@@ -24,6 +24,10 @@ const props = defineProps({
type: Array,
required: true,
},
+ arrayData: {
+ type: Object,
+ required: true,
+ },
});
const { t } = useI18n();
@@ -74,17 +78,6 @@ const loadTypes = async (id) => {
typeList.value = data;
};
-function exprBuilder(param, value) {
- switch (param) {
- case 'categoryFk':
- case 'typeFk':
- return { [param]: value };
- case 'search':
- if (/^\d+$/.test(value)) return { 'i.id': value };
- else return { 'i.name': { like: `%${value}%` } };
- }
-}
-
const applyTags = (tagInfo, params, search) => {
if (!tagInfo || !tagInfo.values.length) {
params.tagGroups = null;
@@ -152,9 +145,8 @@ function addOrder(value, field, params) {
:data-key="props.dataKey"
:hidden-tags="['filter', 'orderFk', 'orderBy']"
:unremovable-params="['orderFk', 'orderBy']"
- :expr-builder="exprBuilder"
:custom-tags="['tagGroups', 'categoryFk']"
- :redirect="false"
+ :arrayData
>
diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue
index aa9bd2fc9..8aefccce8 100644
--- a/src/pages/Order/OrderList.vue
+++ b/src/pages/Order/OrderList.vue
@@ -150,11 +150,23 @@ onMounted(() => {
});
async function fetchClientAddress(id, formData = {}) {
- const { data } = await axios.get(
- `Clients/${id}/addresses?filter[order]=isActive DESC`,
- );
+ const { data } = await axios.get(`Clients/${id}/addresses`, {
+ params: {
+ filter: JSON.stringify({
+ include: [
+ {
+ relation: 'client',
+ scope: {
+ fields: ['defaultAddressFk'],
+ },
+ },
+ ],
+ order: ['isActive DESC'],
+ }),
+ },
+ });
addressOptions.value = data;
- formData.addressId = data.defaultAddressFk;
+ formData.addressId = data[0].client.defaultAddressFk;
fetchAgencies(formData);
}
@@ -162,7 +174,13 @@ async function fetchAgencies({ landed, addressId }) {
if (!landed || !addressId) return (agencyList.value = []);
const { data } = await axios.get('Agencies/landsThatDay', {
- params: { addressFk: addressId, landed },
+ params: {
+ filter: JSON.stringify({
+ order: ['agencyMode DESC', 'agencyModeFk ASC'],
+ }),
+ addressFk: addressId,
+ landed,
+ },
});
agencyList.value = data;
}
@@ -253,6 +271,7 @@ const getDateColor = (date) => {
{
{{ scope.opt?.street }},
{{ scope.opt?.city }}
+
+ {{ `#${scope.opt?.id}` }}
+
diff --git a/src/pages/Route/Agency/composables/__tests__/getAgencies.spec.js b/src/pages/Route/Agency/composables/__tests__/getAgencies.spec.js
index ccf7872cb..99966569c 100644
--- a/src/pages/Route/Agency/composables/__tests__/getAgencies.spec.js
+++ b/src/pages/Route/Agency/composables/__tests__/getAgencies.spec.js
@@ -27,14 +27,17 @@ describe('getAgencies', () => {
landed: 'true',
};
const filter = {
- fields: ['nickname', 'street', 'city', 'id'],
+ fields: ['name', 'street', 'city', 'id'],
where: { isActive: true },
- order: 'nickname ASC',
+ order: ['name ASC'],
};
await getAgencies(formData, null, filter);
- expect(axios.get).toHaveBeenCalledWith('Agencies/getAgenciesWithWarehouse', generateParams(formData, filter));
+ expect(axios.get).toHaveBeenCalledWith(
+ 'Agencies/getAgenciesWithWarehouse',
+ generateParams(formData, filter),
+ );
});
it('should not call API when formData is missing required landed field', async () => {
@@ -64,19 +67,19 @@ describe('getAgencies', () => {
it('should return options and agency when default agency is found', async () => {
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
const client = { defaultAddress: { agencyModeFk: 'Agency1' } };
-
+
const { options, agency } = await getAgencies(formData, client);
-
+
expect(options).toEqual(response.data);
expect(agency).toEqual(response.data[0]);
- });
+ });
- it('should return options and agency when client is not provided', async () => {
+ it('should return options and agency when client is not provided', async () => {
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
-
+
const { options, agency } = await getAgencies(formData);
-
+
expect(options).toEqual(response.data);
expect(agency).toBeNull();
- });
+ });
});
diff --git a/src/pages/Route/Agency/composables/getAgencies.js b/src/pages/Route/Agency/composables/getAgencies.js
index 850f87456..180ac943e 100644
--- a/src/pages/Route/Agency/composables/getAgencies.js
+++ b/src/pages/Route/Agency/composables/getAgencies.js
@@ -1,14 +1,14 @@
import axios from 'axios';
-import agency from 'src/router/modules/agency';
export async function getAgencies(formData, client, _filter = {}) {
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
-
+
const filter = {
- ..._filter
+ ..._filter,
+ order: ['name ASC'],
};
- let defaultAgency = null;
+ let agency = null;
let params = {
filter: JSON.stringify(filter),
warehouseFk: formData.warehouseId,
@@ -16,11 +16,15 @@ export async function getAgencies(formData, client, _filter = {}) {
landed: formData.landed,
};
- const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
+ const { data: options } = await axios.get('Agencies/getAgenciesWithWarehouse', {
+ params,
+ });
- if(data && client) {
- defaultAgency = data.find((agency) => agency.agencyModeFk === client.defaultAddress.agencyModeFk );
- };
-
- return {options: data, agency: defaultAgency}
+ if (options && client) {
+ agency = options.find(
+ ({ agencyModeFk }) => agencyModeFk === client.defaultAddress.agencyModeFk,
+ );
+ }
+
+ return { options, agency };
}
diff --git a/src/pages/Route/Vehicle/Card/VehicleSummary.vue b/src/pages/Route/Vehicle/Card/VehicleSummary.vue
index 981870cb2..e4b0a9497 100644
--- a/src/pages/Route/Vehicle/Card/VehicleSummary.vue
+++ b/src/pages/Route/Vehicle/Card/VehicleSummary.vue
@@ -22,7 +22,12 @@ const links = {
};
-
+
{{ entity.id }} - {{ entity.numberPlate }}
diff --git a/src/pages/Ticket/Card/TicketExpedition.vue b/src/pages/Ticket/Card/TicketExpedition.vue
index f8084ff2f..e9e153b70 100644
--- a/src/pages/Ticket/Card/TicketExpedition.vue
+++ b/src/pages/Ticket/Card/TicketExpedition.vue
@@ -37,7 +37,6 @@ const expeditionStateTypes = ref([]);
const expeditionsFilter = computed(() => ({
where: { ticketFk: route.params.id },
- order: ['created DESC'],
}));
const ticketArrayData = useArrayData('Ticket');
@@ -105,6 +104,9 @@ const columns = computed(() => [
name: 'created',
align: 'left',
cardVisible: true,
+ columnFilter: {
+ component: 'date',
+ },
format: (row) => toDateTimeFormat(row.created),
},
{
@@ -201,7 +203,7 @@ const getExpeditionState = async (expedition) => {
const openGrafana = (expeditionFk) => {
useOpenURL(
- `https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`
+ `https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`,
);
};
@@ -287,7 +289,7 @@ onMounted(async () => {
openConfirmationModal(
'',
t('expedition.removeExpeditionSubtitle'),
- deleteExpedition
+ deleteExpedition,
)
"
>
@@ -302,7 +304,6 @@ onMounted(async () => {
url="Expeditions/filter"
search-url="expeditions"
:columns="columns"
- :filter="expeditionsFilter"
v-model:selected="selectedRows"
:table="{
'row-key': 'id',
@@ -316,11 +317,14 @@ onMounted(async () => {
return { id: value };
case 'packageItemName':
return { packagingItemFk: value };
+ case 'created':
+ return { 'e.created': { gte: value } };
}
}
"
:redirect="false"
order="created DESC"
+ :filter="expeditionsFilter"
>
diff --git a/src/pages/Ticket/Card/TicketService.vue b/src/pages/Ticket/Card/TicketService.vue
index 6ce69a6aa..1bd1548a4 100644
--- a/src/pages/Ticket/Card/TicketService.vue
+++ b/src/pages/Ticket/Card/TicketService.vue
@@ -121,6 +121,50 @@ async function handleSave() {
isSaving.value = false;
}
}
+function validateFields(item) {
+ // Only validate fields that are being updated
+ const shouldExist = (field) => !isUpdate || field in item;
+
+ if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) {
+ notify('Description is required', 'negative');
+ return false;
+ }
+
+ if (!shouldExist('quantity') && (!item.quantity || item.quantity <= 0)) {
+ notify('Quantity must be greater than 0', 'negative');
+ return false;
+ }
+
+ if (!shouldExist('price') && (!item.price || item.price < 0)) {
+ notify('Price must be valid', 'negative');
+ return false;
+ }
+
+ return true;
+}
+
+function beforeSave(data) {
+ const { creates = [], updates = [] } = data;
+ const validData = { creates: [], updates: [] };
+
+ // Validate creates
+ if (creates.length) {
+ for (const create of creates) {
+ create.ticketFk = route.params.id;
+ if (validateFields(create)) {
+ validData.creates.push(create);
+ }
+ }
+ }
+
+ // Validate updates
+ if (updates.length) {
+ for (const update of updates) {
+ validData.updates.push(update);
+ }
+ }
+ return validData;
+}
@@ -141,6 +185,7 @@ async function handleSave() {
v-model:selected="selected"
:order="['description ASC']"
:default-remove="false"
+ :beforeSaveFn="beforeSave"
>
@@ -196,6 +243,7 @@ async function handleSave() {
:label="col.label"
v-model.number="row.price"
type="number"
+ :required="true"
min="0"
@keyup.enter="handleSave"
/>
diff --git a/src/pages/Ticket/Card/TicketTransferProxy.vue b/src/pages/Ticket/Card/TicketTransferProxy.vue
index 3f3f018df..7d5d82f85 100644
--- a/src/pages/Ticket/Card/TicketTransferProxy.vue
+++ b/src/pages/Ticket/Card/TicketTransferProxy.vue
@@ -42,7 +42,7 @@ const transferRef = ref(null);
/>
-
+
(stateStore.rightDrawer = true));
{{ row.item.name }}
{{ row.item.subName }}
-
+
{{ packingTypeVolume?.[rowIndex]?.volume }}
diff --git a/src/pages/Ticket/TicketAdvance.vue b/src/pages/Ticket/TicketAdvance.vue
index 6b2ed38d3..bf3593acd 100644
--- a/src/pages/Ticket/TicketAdvance.vue
+++ b/src/pages/Ticket/TicketAdvance.vue
@@ -456,6 +456,7 @@ watch(
:pagination="{ rowsPerPage: 0 }"
:no-data-label="t('globals.noResults')"
:right-search="false"
+ :order="['futureTotalWithVat ASC']"
auto-load
:disable-option="{ card: true }"
>
diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue
index e43c69cf2..f0e29115e 100644
--- a/src/pages/Ticket/TicketFilter.vue
+++ b/src/pages/Ticket/TicketFilter.vue
@@ -46,7 +46,12 @@ const getGroupedStates = (data) => {
"
auto-load
/>
- (agencies = data)" auto-load />
+ (agencies = data)"
+ auto-load
+ />
(warehouses = data)" auto-load />
@@ -74,10 +79,20 @@ const getGroupedStates = (data) => {
-
+
-
+
diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue
index 3fbbbd549..cc27038c0 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -1,6 +1,6 @@
@@ -451,7 +490,7 @@ function setReference(data) {
urlCreate: 'Tickets/new',
title: t('ticketList.createTicket'),
onDataSaved: ({ id }) => tableRef.redirect(id),
- formInitialData: { clientId: null },
+ formInitialData,
}"
default-mode="table"
:columns="columns"
@@ -533,11 +572,9 @@ function setReference(data) {
:label="t('ticketList.client')"
v-model="data.clientId"
:options="clientsOptions"
- option-value="id"
- option-label="name"
hide-selected
required
- @update:model-value="(client) => onClientSelected(data)"
+ @update:model-value="() => onClientSelected(data)"
:sort-by="'id ASC'"
>
@@ -559,7 +596,6 @@ function setReference(data) {
:label="t('basicData.address')"
v-model="data.addressId"
:options="addressesOptions"
- option-value="id"
option-label="nickname"
hide-selected
map-options
@@ -605,6 +641,9 @@ function setReference(data) {
{{ scope.opt?.city }}
+
+ {{ `#${scope.opt?.id}` }}
+
@@ -628,8 +667,6 @@ function setReference(data) {
:label="t('globals.warehouse')"
v-model="data.warehouseId"
:options="warehousesOptions"
- option-value="id"
- option-label="name"
hide-selected
required
@update:model-value="() => fetchAvailableAgencies(data)"
@@ -689,7 +726,6 @@ function setReference(data) {
:label="t('ticketList.company')"
v-model="dialogData.companyFk"
:options="companiesOptions"
- option-value="id"
option-label="code"
hide-selected
>
@@ -700,7 +736,6 @@ function setReference(data) {
:label="t('ticketList.bank')"
v-model="dialogData.bankFk"
:options="accountingOptions"
- option-value="id"
option-label="bank"
hide-selected
@update:model-value="setReference"
diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue
index 56a9548c6..a78983e5c 100644
--- a/src/pages/Worker/Card/WorkerBasicData.vue
+++ b/src/pages/Worker/Card/WorkerBasicData.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/stores/useStateStore.js b/src/stores/useStateStore.js
index e48b67279..ca447bc11 100644
--- a/src/stores/useStateStore.js
+++ b/src/stores/useStateStore.js
@@ -7,7 +7,11 @@ export const useStateStore = defineStore('stateStore', () => {
const rightDrawer = ref(false);
const rightAdvancedDrawer = ref(false);
const subToolbar = ref(false);
+ const cardDescriptor = ref(null);
+ function cardDescriptorChangeValue(descriptor) {
+ cardDescriptor.value = descriptor;
+ }
function toggleLeftDrawer() {
leftDrawer.value = !leftDrawer.value;
}
@@ -49,6 +53,8 @@ export const useStateStore = defineStore('stateStore', () => {
}
return {
+ cardDescriptor,
+ cardDescriptorChangeValue,
leftDrawer,
rightDrawer,
rightAdvancedDrawer,
diff --git a/test/cypress/integration/client/clientAddress.spec.js b/test/cypress/integration/client/clientAddress.spec.js
index 8673c9083..5d82aa4bc 100644
--- a/test/cypress/integration/client/clientAddress.spec.js
+++ b/test/cypress/integration/client/clientAddress.spec.js
@@ -17,7 +17,7 @@ describe('Client consignee', () => {
const addressName = 'test';
cy.dataCy('Consignee_input').type(addressName);
cy.dataCy('Location_select').click();
- cy.get('[role="listbox"] .q-item:nth-child(1)').click();
+ cy.getOption();
cy.dataCy('Street address_input').type('TEST ADDRESS');
cy.get('.q-btn-group > .q-btn--standard').click();
cy.location('href').should('contain', '#/customer/1107/address');
diff --git a/test/cypress/integration/entry/entryList.spec.js b/test/cypress/integration/entry/entryList.spec.js
index bdaa66f79..d43ec895a 100644
--- a/test/cypress/integration/entry/entryList.spec.js
+++ b/test/cypress/integration/entry/entryList.spec.js
@@ -1,4 +1,4 @@
-describe.skip('Entry', () => {
+describe('Entry', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('buyer');
diff --git a/test/cypress/integration/entry/stockBought.spec.js b/test/cypress/integration/entry/stockBought.spec.js
index 87cbb3f9c..91e0d507e 100644
--- a/test/cypress/integration/entry/stockBought.spec.js
+++ b/test/cypress/integration/entry/stockBought.spec.js
@@ -1,4 +1,4 @@
-describe.skip('EntryStockBought', () => {
+describe('EntryStockBought', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('buyer');
@@ -16,9 +16,9 @@ describe.skip('EntryStockBought', () => {
cy.get('input[aria-label="Reserve"]').type('1');
cy.get('input[aria-label="Date"]').eq(1).clear();
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
- cy.get('input[aria-label="Buyer"]').type('buyerBossNick');
+ cy.get('input[aria-label="Buyer"]').type('itNick');
cy.get('div[role="listbox"] > div > div[role="option"]')
- .eq(0)
+ .eq(1)
.should('be.visible')
.click();
diff --git a/test/cypress/integration/route/vehicle/vehicleList.spec.js b/test/cypress/integration/route/vehicle/vehicleList.spec.js
new file mode 100644
index 000000000..2b3c9cdbc
--- /dev/null
+++ b/test/cypress/integration/route/vehicle/vehicleList.spec.js
@@ -0,0 +1,59 @@
+describe('Vehicle list', () => {
+ const selectors = {
+ saveFormBtn: 'FormModelPopup_save',
+ summaryPopupBtn: 'tr:last-child > .q-table--col-auto-width > .q-btn',
+ summaryGoToSummaryBtn: '.header > .q-icon',
+ summaryHeader: '.summaryHeader > div',
+ numberPlate: 'tr:last-child > [data-col-field="numberPlate"] > .no-padding',
+ };
+
+ const data = {
+ 'Nº Plate': { val: '9465-LPA' },
+ 'Trade Mark': { val: 'WAYNE INDUSTRIES' },
+ Model: { val: 'BATREMOLQUE' },
+ Type: { val: 'remolque', type: 'select' },
+ Warehouse: { val: 'Warehouse One', type: 'select' },
+ Country: { val: 'Portugal', type: 'select' },
+ Description: { val: 'Exclusive for batpod transport' },
+ };
+
+ const expected = data['Nº Plate'].val;
+ const summaryUrl = '/summary';
+
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit(`/#/route/vehicle/list`);
+ cy.typeSearchbar('{enter}');
+ });
+
+ it('should list vehicles', () => {
+ cy.get('.q-table')
+ .children()
+ .should('be.visible')
+ .should('have.length.greaterThan', 0);
+ });
+
+ it('Should add new vehicle', () => {
+ cy.addBtnClick();
+ cy.fillInForm(data);
+ cy.dataCy(selectors.saveFormBtn).should('be.visible').click();
+
+ cy.checkNotification('Data created');
+ cy.get(selectors.summaryHeader).should('contain', expected);
+ cy.url().should('include', summaryUrl);
+ });
+
+ it('should open summary by clicking a vehicle', () => {
+ cy.get(selectors.numberPlate).click();
+ cy.get(selectors.summaryHeader).should('contain', expected);
+ cy.url().should('include', summaryUrl);
+ });
+
+ it('should redirect to vehicle summary when click summary icon on summary pop-up', () => {
+ cy.get(selectors.summaryPopupBtn).click();
+ cy.get(selectors.summaryHeader).should('contain', expected);
+ cy.get(selectors.summaryGoToSummaryBtn).click();
+ cy.url().should('include', summaryUrl);
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketFilter.spec.js b/test/cypress/integration/ticket/ticketFilter.spec.js
new file mode 100644
index 000000000..2e5a3f3ce
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketFilter.spec.js
@@ -0,0 +1,15 @@
+///
+describe('TicketFilter', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/list');
+ });
+
+ it('use search button', function () {
+ cy.waitForElement('.q-page');
+ cy.get('[data-cy="Customer ID_input"]').type('1105');
+ cy.searchBtnFilterPanel();
+ cy.location('href').should('contain', '#/ticket/15/summary');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index 1c96b027f..c9b3092a8 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -1,6 +1,6 @@
///
-describe.skip('TicketList', () => {
- const firstRow = 'tbody > :nth-child(1)';
+describe('TicketList', () => {
+ const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
beforeEach(() => {
cy.login('developer');
@@ -9,15 +9,14 @@ describe.skip('TicketList', () => {
});
const searchResults = (search) => {
- cy.dataCy('vn-searchbar').find('input').focus();
- if (search) cy.dataCy('vn-searchbar').find('input').type(search);
+ if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').find('input').type('{enter}');
- cy.dataCy('ticketListTable').should('exist');
+ // cy.dataCy('ticketListTable').should('exist');
cy.get(firstRow).should('exist');
};
it('should search results', () => {
- cy.dataCy('ticketListTable').should('not.exist');
+ // cy.dataCy('ticketListTable').should('not.exist');
cy.get('.q-field__control').should('exist');
searchResults();
});
@@ -27,7 +26,7 @@ describe.skip('TicketList', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
- cy.get(firstRow).find('.q-btn:first').click();
+ cy.get(firstRow).should('be.visible').find('.q-btn:first').click();
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
});
@@ -38,6 +37,21 @@ describe.skip('TicketList', () => {
cy.get('.summaryBody').should('exist');
});
+ it('filter client and create ticket', () => {
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
+ searchResults();
+
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
+ cy.dataCy('Customer ID_input').clear('1');
+ cy.dataCy('Customer ID_input').type('1101{enter}');
+
+ cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
+ cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
+ cy.dataCy('Address_select').click();
+
+ cy.getOption().click();
+ cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
+ });
it('Client list create new client', () => {
cy.dataCy('vnTableCreateBtn').should('exist');
cy.dataCy('vnTableCreateBtn').click();
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index b59765ca6..805198857 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -112,7 +112,6 @@ describe('TicketSale', () => {
cy.dataCy('ticketSaleTransferBtn').click();
cy.dataCy('ticketTransferPopup').should('exist');
cy.dataCy('ticketTransferNewTicketBtn').click();
- //check the new ticket has been created succesfully
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
});
@@ -138,7 +137,7 @@ describe('TicketSale', () => {
it('update price', () => {
const price = Number((Math.random() * 99 + 1).toFixed(2));
cy.waitForElement(firstRow);
- cy.get(':nth-child(10) > .q-btn').click();
+ cy.get('[data-col-field="price"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
cy.waitForElement('[data-cy="Price_input"]');
@@ -147,15 +146,14 @@ describe('TicketSale', () => {
cy.dataCy('saveManaBtn').click();
handleVnConfirm();
- cy.get(':nth-child(10) > .q-btn > .q-btn__content').should(
- 'have.text',
- `€${price}`,
- );
+ cy.get('[data-col-field="price"]')
+ .find('.q-btn > .q-btn__content')
+ .should('have.text', `€${price}`);
});
- it('update dicount', () => {
+ it('update discount', () => {
const discount = Math.floor(Math.random() * 100) + 1;
selectFirstRow();
- cy.get(':nth-child(11) > .q-btn').click();
+ cy.get('[data-col-field="discount"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
cy.waitForElement('[data-cy="Disc_input"]');
@@ -164,26 +162,24 @@ describe('TicketSale', () => {
cy.dataCy('saveManaBtn').click();
handleVnConfirm();
- cy.get(':nth-child(11) > .q-btn > .q-btn__content').should(
- 'have.text',
- `${discount}.00%`,
- );
+ cy.get('[data-col-field="discount"]')
+ .find('.q-btn > .q-btn__content')
+ .should('have.text', `${discount}.00%`);
});
it('change concept', () => {
- const quantity = Math.floor(Math.random() * 100) + 1;
+ const concept = 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)
+ cy.get('[data-col-field="item"]').click();
+ cy.get('.q-menu')
+ .find('[data-cy="undefined_input"]')
+ .type(concept)
.type('{enter}');
handleVnConfirm();
- cy.get(':nth-child(8) >.row').should('contain.text', `${quantity}`);
+ cy.get('[data-col-field="item"]').should('contain.text', `${concept}`);
});
- it('changequantity ', () => {
+ it('change quantity ', () => {
const quantity = Math.floor(Math.random() * 100) + 1;
cy.waitForElement(firstRow);
cy.dataCy('ticketSaleQuantityInput').clear();
@@ -200,7 +196,7 @@ describe('TicketSale', () => {
});
function handleVnConfirm() {
- cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
+ cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.waitForElement('.q-notification__message');
cy.get('.q-notification__message').should('be.visible');
diff --git a/test/cypress/integration/vnComponent/UserPanel.spec.js b/test/cypress/integration/vnComponent/UserPanel.spec.js
index e83d07954..25724e873 100644
--- a/test/cypress/integration/vnComponent/UserPanel.spec.js
+++ b/test/cypress/integration/vnComponent/UserPanel.spec.js
@@ -18,7 +18,7 @@ describe('UserPanel', () => {
cy.get(userWarehouse).should('have.value', 'VNL').click();
// Actualizo la opción
- getOption(3);
+ cy.getOption(3);
//Compruebo la notificación
cy.get('.q-notification').should('be.visible');
@@ -26,7 +26,7 @@ describe('UserPanel', () => {
//Restauro el valor
cy.get(userWarehouse).click();
- getOption(2);
+ cy.getOption(2);
});
it('should notify when update user company', () => {
const userCompany =
@@ -39,7 +39,7 @@ describe('UserPanel', () => {
cy.get(userCompany).should('have.value', 'Warehouse One').click();
//Actualizo la opción
- getOption(2);
+ cy.getOption(2);
//Compruebo la notificación
cy.get('.q-notification').should('be.visible');
@@ -47,12 +47,6 @@ describe('UserPanel', () => {
//Restauro el valor
cy.get(userCompany).click();
- getOption(1);
+ cy.getOption(1);
});
});
-
-function getOption(index) {
- cy.waitForElement('[role="listbox"]');
- const option = `[role="listbox"] .q-item:nth-child(${index})`;
- cy.get(option).click();
-}
diff --git a/test/cypress/integration/vnComponent/VnLocation.spec.js b/test/cypress/integration/vnComponent/VnLocation.spec.js
index 986cbcaaf..ee49d6065 100644
--- a/test/cypress/integration/vnComponent/VnLocation.spec.js
+++ b/test/cypress/integration/vnComponent/VnLocation.spec.js
@@ -88,7 +88,7 @@ describe('VnLocation', () => {
cy.get(
firstOption.concat(' > .q-item__section > .q-item__label--caption'),
).should('have.text', postCodeLabel);
- cy.get(firstOption).click();
+ cy.getOption();
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
cy.reload();
cy.waitForElement('.q-form');
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 096a29dc1..dfec341cd 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -393,6 +393,22 @@ Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.wrap($btn).click();
});
});
+
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
cy.get('.q-btn').contains(buttonText).click();
});
+
+Cypress.Commands.add('getOption', (index = 1) => {
+ cy.waitForElement('[role="listbox"]');
+ cy.get(`[role="listbox"] .q-item:nth-child(${index})`).click();
+});
+
+Cypress.Commands.add('searchBtnFilterPanel', () => {
+ cy.get(
+ '.q-scrollarea__content > .q-btn--standard > .q-btn__content > .q-icon',
+ ).click();
+});
+
+Cypress.Commands.add('waitRequest', (alias, cb) => {
+ cy.wait(alias).then(cb);
+});