diff --git a/src/pages/Ticket/Card/TicketSaleMoreActions.vue b/src/pages/Ticket/Card/TicketSaleMoreActions.vue
index 94db67be2..2ec519d2d 100644
--- a/src/pages/Ticket/Card/TicketSaleMoreActions.vue
+++ b/src/pages/Ticket/Card/TicketSaleMoreActions.vue
@@ -44,7 +44,7 @@ const props = defineProps({
},
});
-const router = useRouter();
+const { push } = useRouter();
const { t } = useI18n();
const { dialog } = useQuasar();
const { notify } = useNotify();
@@ -142,7 +142,7 @@ const onCreateClaimAccepted = async () => {
try {
const params = { ticketId: ticket.value.id, sales: props.sales };
const { data } = await axios.post(`Claims/createFromSales`, params);
- router.push({ name: 'ClaimBasicData', params: { id: data.id } });
+ push({ name: 'ClaimBasicData', params: { id: data.id } });
} catch (error) {
console.error('Error creating claim: ', error);
}
@@ -169,7 +169,7 @@ const createRefund = async (withWarehouse) => {
const { data } = await axios.post('Tickets/cloneAll', params);
const [refundTicket] = data;
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
- router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
+ push({ name: 'TicketSale', params: { id: refundTicket.id } });
} catch (error) {
console.error(error);
}
diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue
index b6a60122c..af96c2724 100644
--- a/src/pages/Ticket/Card/TicketSummary.vue
+++ b/src/pages/Ticket/Card/TicketSummary.vue
@@ -1,7 +1,7 @@
@@ -185,6 +158,11 @@ const onThermographCreated = async (data) => {
:filter="{ order: 'name' }"
auto-load
/>
+ (temperaturesOptions = data)"
+ auto-load
+ url="Temperatures"
+ />
{
(thermographForm.thermographId = data.id)
- "
+ @on-data-saved="onThermographCreated"
/>
@@ -271,6 +248,26 @@ const onThermographCreated = async (data) => {
option-label="name"
/>
+
+
+
+
+
+
{
-es:
- Select files: Selecciona ficheros
- Thermograph created: Termógrafo creado
- New thermograph: Nuevo termógrafo
+ es:
+ Select files: Selecciona ficheros
+ Thermograph created: Termógrafo creado
+ New thermograph: Nuevo termógrafo
diff --git a/src/pages/Travel/TravelFilter.vue b/src/pages/Travel/TravelFilter.vue
new file mode 100644
index 000000000..96298853f
--- /dev/null
+++ b/src/pages/Travel/TravelFilter.vue
@@ -0,0 +1,157 @@
+
+
+
+ (states = data)" auto-load />
+
+
+
+ {{ t(`params.${tag.label}`) }}:
+ {{ formatFn(tag.value) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+en:
+ travel:
+ Id: Contains
+ ref: Reference
+ agency: Agency
+ warehouseInFk: W. In
+ shipped: Shipped
+ shipmentHour: Shipment Hour
+ warehouseOut: W. Out
+ landed: Landed
+ landingHour: Landing Hour
+ totalEntries: Σ
+es:
+ travel:
+ Id: Id
+ ref: Referencia
+ agency: Agencia
+ warehouseInFk: Alm.Salida
+ shipped: F.Envío
+ shipmentHour: Hora de envío
+ warehouseOut: Alm.Entrada
+ landed: F.Entrega
+ landingHour: Hora de entrega
+ totalEntries: Σ
+
diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue
index e56f5d2ff..05d2e5eda 100644
--- a/src/pages/Travel/TravelList.vue
+++ b/src/pages/Travel/TravelList.vue
@@ -9,6 +9,8 @@ import TravelSummary from './Card/TravelSummary.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { toDate } from 'src/filters';
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
+import RightMenu from 'src/components/common/RightMenu.vue';
+import TravelFilter from './TravelFilter.vue';
const { viewSummary } = useSummaryDialog();
const router = useRouter();
@@ -24,6 +26,7 @@ const $props = defineProps({
});
const entityId = computed(() => $props.id || route.params.id);
+const travelFilterRef = ref();
onMounted(async () => {
stateStore.rightDrawer = true;
});
@@ -201,6 +204,11 @@ const columns = computed(() => [
:label="t('Search travel')"
data-key="TravelList"
/>
+
+
+
+
+
[
editorFk: entityId,
},
}"
+ :right-search="false"
:user-params="{ daysOnward: 7 }"
order="landed DESC"
:columns="columns"
@@ -220,7 +229,6 @@ const columns = computed(() => [
redirect="travel"
:is-editable="false"
:use-model="true"
- chip-locale="travel.travelList.tableVisibleColumns"
>
[
field: 'concept',
cardVisible: true,
},
+ {
+ align: 'right',
+ name: 'tableActions',
+ style: 'max-width: 20px; text-align: initial;',
+ actions: [
+ {
+ title: t('delete'),
+ icon: 'delete',
+ action: async (row) => await tableRef.value.CrudModelRef.remove([row]),
+ isPrimary: true,
+ },
+ ],
+ },
]);
-
[
save-url="WorkerIncomes/crud"
:create="{
urlCreate: 'workerIncomes',
- title: t('Create workerBalance'),
+ title: t('Create balance'),
onDataSaved: () => tableRef.reload(),
formInitialData: {
workerFk: entityId,
@@ -81,10 +93,10 @@ const columns = computed(() => [
:right-search="false"
:is-editable="true"
:use-model="true"
+ :default-remove="false"
/>
-
es:
- Create workerBalance: Crear balance
+ Create balance: Crear balance
diff --git a/src/pages/Worker/Card/WorkerChangePasswordForm.vue b/src/pages/Worker/Card/WorkerChangePasswordForm.vue
deleted file mode 100644
index 20132f21e..000000000
--- a/src/pages/Worker/Card/WorkerChangePasswordForm.vue
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-es:
- Reset password: Restablecer contraseña
- New password: Nueva contraseña
- Repeat password: Repetir contraseña
- You must enter a new password: Debes introducir la nueva contraseña
- Passwords don't match: Las contraseñas no coinciden
-
diff --git a/src/pages/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue
index 3675d40f8..1cb42bbfb 100644
--- a/src/pages/Worker/Card/WorkerDescriptor.vue
+++ b/src/pages/Worker/Card/WorkerDescriptor.vue
@@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
-import WorkerChangePasswordForm from 'src/pages/Worker/Card/WorkerChangePasswordForm.vue';
+import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import VnImg from 'src/components/ui/VnImg.vue';
@@ -24,18 +24,13 @@ const route = useRoute();
const { t } = useI18n();
const state = useState();
const user = state.getUser();
-const changePasswordFormDialog = ref(null);
-const cardDescriptorRef = ref(null);
const showEditPhotoForm = ref(false);
const toggleEditPictureForm = () => {
showEditPhotoForm.value = !showEditPhotoForm.value;
};
-
const entityId = computed(() => {
return $props.id || route.params.id;
});
-
-const worker = ref();
const workerExcluded = ref(false);
const getIsExcluded = async () => {
@@ -61,10 +56,10 @@ const handleExcluded = async () => {
workerExcluded.value = !workerExcluded.value;
};
+
const handlePhotoUpdated = (evt = false) => {
image.value.reload(evt);
};
-const refetch = async () => await cardDescriptorRef.value.getData();
await cardDescriptorRef.value.getData();
url="Workers/descriptor"
:filter="{ where: { id: entityId } }"
title="user.nickname"
- @on-fetch="
- (data) => {
- worker = data;
- getIsExcluded();
- }
- "
+ @on-fetch="getIsExcluded"
>
-
-
+
+
{{
workerExcluded
@@ -92,16 +82,13 @@ const refetch = async () => await cardDescriptorRef.value.getData();
- {{ t('Change password') }}
-
-
-
+ {{ t('globals.changePass') }}
@@ -167,10 +154,10 @@ const refetch = async () => await cardDescriptorRef.value.getData();
-
+
{{ t('worker.summary.sipExtension') }}
-
+
@@ -201,6 +188,15 @@ const refetch = async () => await cardDescriptorRef.value.getData();
+
es:
Create training course: Crear curso de formación
diff --git a/src/pages/Worker/Card/WorkerMedical.vue b/src/pages/Worker/Card/WorkerMedical.vue
index 6bca4ae85..fab1416c9 100644
--- a/src/pages/Worker/Card/WorkerMedical.vue
+++ b/src/pages/Worker/Card/WorkerMedical.vue
@@ -65,6 +65,18 @@ const columns = [
create: true,
component: 'input',
},
+ {
+ align: 'right',
+ name: 'tableActions',
+ actions: [
+ {
+ title: t('delete'),
+ icon: 'delete',
+ action: async (row) => await tableRef.value.CrudModelRef.remove([row]),
+ isPrimary: true,
+ },
+ ],
+ },
];
@@ -87,5 +99,6 @@ const columns = [
:right-search="false"
:is-editable="true"
:use-model="true"
+ :default-remove="false"
/>
diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue
index 8fee52dd3..ed34e771d 100644
--- a/src/pages/Worker/Card/WorkerSummary.vue
+++ b/src/pages/Worker/Card/WorkerSummary.vue
@@ -139,6 +139,7 @@ onBeforeMount(async () => {
+
diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue
index fbfd4b28d..39fb536b6 100644
--- a/src/pages/Worker/Card/WorkerTimeControl.vue
+++ b/src/pages/Worker/Card/WorkerTimeControl.vue
@@ -326,16 +326,20 @@ const updateData = async () => {
};
const getMailStates = async (date) => {
+ const url = `WorkerTimeControls/${route.params.id}/getMailStates`;
+ const month = date.getMonth() + 1;
+ const prevMonth = month == 1 ? 12 : month - 1;
const params = {
- month: date.getMonth() + 1,
+ month,
year: date.getFullYear(),
};
- const { data } = await axios.get(
- `WorkerTimeControls/${route.params.id}/getMailStates`,
- { params }
- );
- workerTimeControlMails.value = data;
+ const curMonthStates = (await axios.get(url, { params })).data;
+ const prevMonthStates = (
+ await axios.get(url, { params: { ...params, month: prevMonth } })
+ ).data;
+
+ workerTimeControlMails.value = curMonthStates.concat(prevMonthStates);
};
const showWorkerTimeForm = (propValue, formType) => {
diff --git a/src/pages/Worker/WorkerFilter.vue b/src/pages/Worker/WorkerFilter.vue
index 765241341..dfb5659fe 100644
--- a/src/pages/Worker/WorkerFilter.vue
+++ b/src/pages/Worker/WorkerFilter.vue
@@ -7,7 +7,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
-const { t } = useI18n();
+const { t, te } = useI18n();
const props = defineProps({
dataKey: {
type: String,
@@ -16,6 +16,11 @@ const props = defineProps({
});
const departments = ref();
+
+const getLocale = (label) => {
+ const globalLocale = `globals.params.${label}`;
+ return te(globalLocale) ? t(globalLocale) : t(`params.${label}`);
+};
@@ -23,7 +28,7 @@ const departments = ref();
- {{ t(`params.${tag.label}`) }}:
+ {{ getLocale(tag.label) }}:
{{ formatFn(tag.value) }}
@@ -64,10 +69,7 @@ const departments = ref();
-
-
-
-
+
+
+
+
+
+
[
},
{
align: 'left',
- name: 'nickname',
- label: t('tableColumns.name'),
+ name: 'firstName',
+ label: t('tableColumns.firstName'),
isTitle: true,
columnFilter: {
name: 'firstName',
},
},
+ {
+ align: 'left',
+ name: 'lastName',
+ label: t('tableColumns.lastName'),
+ isTitle: true,
+ columnFilter: {
+ name: 'lastName',
+ },
+ },
+ {
+ align: 'left',
+ name: 'nickname',
+ label: t('tableColumns.userName'),
+ isTitle: true,
+ columnFilter: {
+ name: 'userName',
+ },
+ },
{
align: 'left',
name: 'departmentFk',
@@ -66,10 +84,17 @@ const columns = computed(() => [
label: t('tableColumns.email'),
cardVisible: true,
columnFilter: {
- alias: 'mu',
- inWhere: true,
+ name: 'email',
+ },
+ },
+ {
+ align: 'left',
+ name: 'extension',
+ label: t('tableColumns.extension'),
+ cardVisible: true,
+ columnFilter: {
+ name: 'extension',
},
- hidden: true,
},
{
align: 'right',
@@ -180,7 +205,7 @@ async function autofillBic(worker) {
default-mode="table"
redirect="worker"
:right-search="false"
- auto-load
+ :order="['id DESC']"
>
@@ -214,6 +239,7 @@ async function autofillBic(worker) {
@@ -262,6 +288,7 @@ async function autofillBic(worker) {
handleLocation(data, location)"
diff --git a/src/pages/Worker/locale/en.yml b/src/pages/Worker/locale/en.yml
index 96df37919..8276977fd 100644
--- a/src/pages/Worker/locale/en.yml
+++ b/src/pages/Worker/locale/en.yml
@@ -1,6 +1,12 @@
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
tableColumns:
id: ID
- name: Name
+ firstName: First name
+ lastName: Last Name
+ userName: User Name
department: Department
email: Email
+ 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 41812345f..9c7618bc3 100644
--- a/src/pages/Worker/locale/es.yml
+++ b/src/pages/Worker/locale/es.yml
@@ -6,6 +6,12 @@ External: Externo
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
tableColumns:
id: ID
- name: Nombre
+ firstName: Nombre
+ lastName: Apellidos
+ userName: Nombre de usuario
department: Departamento
email: Email
+ fi: NIF
+ SSN: NSS
+ extension: Extensión
+queue: Cola
diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue
index 0ba2e640a..215c12f46 100644
--- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue
+++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue
@@ -154,7 +154,7 @@ onMounted(() => {
(stateStore.rightDrawer = false));
-
-
-
-
-
- {{ t('globals.collapseMenu') }}
-
-
-
-
-
import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
import { useRoute } from 'vue-router';
-
+import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import { useArrayData } from 'composables/useArrayData';
@@ -144,7 +144,8 @@ watch(storeData, async (val) => {
});
const reFetch = async () => {
- await arrayData.fetch({ append: false });
+ const { data } = await arrayData.fetch({ append: false });
+ nodes.value = data;
};
onMounted(async () => {
@@ -182,6 +183,16 @@ onUnmounted(() => {
+
+
+
+
+
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/route.js b/src/router/modules/route.js
index 3c5c860cf..9a7b16df3 100644
--- a/src/router/modules/route.js
+++ b/src/router/modules/route.js
@@ -11,7 +11,14 @@ export default {
component: RouterView,
redirect: { name: 'RouteMain' },
menus: {
- main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'],
+ main: [
+ 'RouteList',
+ 'RouteExtendedList',
+ 'RouteAutonomous',
+ 'RouteRoadmap',
+ 'CmrList',
+ 'AgencyList',
+ ],
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
},
children: [
@@ -19,9 +26,6 @@ export default {
path: '/route',
name: 'RouteMain',
component: () => import('src/components/common/VnSectionMain.vue'),
- props: {
- leftDrawer: false,
- },
redirect: { name: 'RouteList' },
children: [
{
@@ -33,6 +37,15 @@ export default {
},
component: () => import('src/pages/Route/RouteList.vue'),
},
+ {
+ path: 'extended-list',
+ name: 'RouteExtendedList',
+ meta: {
+ title: 'RouteExtendedList',
+ icon: 'format_list_bulleted',
+ },
+ component: () => import('src/pages/Route/RouteExtendedList.vue'),
+ },
{
path: 'create',
name: 'RouteCreate',
@@ -78,7 +91,7 @@ export default {
name: 'AgencyList',
meta: {
title: 'agencyList',
- icon: 'view_list',
+ icon: 'list',
},
component: () =>
import('src/pages/Route/Agency/AgencyList.vue'),
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index b2716474b..7258881be 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -168,6 +168,7 @@ export default {
meta: {
title: 'log',
icon: 'vn:History',
+ acls: [{ model: 'WorkerLog', props: 'find', accessType: 'READ' }],
},
component: () => import('src/pages/Worker/Card/WorkerLog.vue'),
},
diff --git a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
index 6d33dbc39..353c5805b 100644
--- a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
+++ b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
@@ -4,12 +4,12 @@ describe('AgencyWorkCenter', () => {
cy.login('developer');
cy.visit(`/#/agency/11/workCenter`);
});
+ const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
+ const workCenterCombobox = 'input[role="combobox"]';
it('assign workCenter', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(
- '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
- ).type('workCenterOne{enter}');
+ cy.get(createButton).click();
+ cy.get(workCenterCombobox).type('workCenterOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
});
@@ -22,12 +22,10 @@ describe('AgencyWorkCenter', () => {
});
it('error on duplicate workCenter', () => {
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
- cy.get(
- '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
- ).type('workCenterOne{enter}');
+ cy.get(createButton).click();
+ cy.get(workCenterCombobox).type('workCenterOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
- cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
+ cy.get(createButton).click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js
index c9d7147c2..8020d3ea9 100644
--- a/test/cypress/integration/route/routeList.spec.js
+++ b/test/cypress/integration/route/routeList.spec.js
@@ -2,7 +2,7 @@ describe('Route', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
- cy.visit(`/#/route/list`);
+ cy.visit(`/#/route/extended-list`);
});
const getVnSelect =
'> :nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index 8192b7c7c..cc3a1d65a 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -1,7 +1,7 @@
///
describe('Ticket descriptor', () => {
- const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
- const setWeightOpt = '[role="menu"] .q-list > :nth-child(6)';
+ const toCloneOpt = '[role="menu"] .q-list > :nth-child(8)';
+ const setWeightOpt = '[role="menu"] .q-list > :nth-child(13)';
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
const summaryHeader = '.summaryHeader > div';
const weight = 25;
diff --git a/test/cypress/integration/vnComponent/UserPanel.spec.js b/test/cypress/integration/vnComponent/UserPanel.spec.js
new file mode 100644
index 000000000..e83d07954
--- /dev/null
+++ b/test/cypress/integration/vnComponent/UserPanel.spec.js
@@ -0,0 +1,58 @@
+///
+describe('UserPanel', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit(`/#dashboard`);
+ cy.waitForElement('.q-page', 6000);
+ });
+
+ it('should notify when update user warehouse', () => {
+ const userWarehouse =
+ '.q-menu .q-gutter-xs > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native> .q-field__input';
+
+ // Abro el panel
+ cy.openUserPanel();
+
+ // Compruebo la opcion inicial
+ cy.get(userWarehouse).should('have.value', 'VNL').click();
+
+ // Actualizo la opción
+ getOption(3);
+
+ //Compruebo la notificación
+ cy.get('.q-notification').should('be.visible');
+ cy.get(userWarehouse).should('have.value', 'VNH');
+
+ //Restauro el valor
+ cy.get(userWarehouse).click();
+ getOption(2);
+ });
+ it('should notify when update user company', () => {
+ const userCompany =
+ '.q-menu .q-gutter-xs > :nth-child(2) > .q-field--float > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native> .q-field__input';
+
+ // Abro el panel
+ cy.openUserPanel();
+
+ // Compruebo la opcion inicial
+ cy.get(userCompany).should('have.value', 'Warehouse One').click();
+
+ //Actualizo la opción
+ getOption(2);
+
+ //Compruebo la notificación
+ cy.get('.q-notification').should('be.visible');
+ cy.get(userCompany).should('have.value', 'Warehouse Two');
+
+ //Restauro el valor
+ cy.get(userCompany).click();
+ 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 1872d3591..78dc38899 100644
--- a/test/cypress/integration/vnComponent/vnLocation.spec.js
+++ b/test/cypress/integration/vnComponent/vnLocation.spec.js
@@ -3,25 +3,90 @@ describe('VnLocation', () => {
const dialogInputs = '.q-dialog label input';
const createLocationButton = '.q-form > .q-card > .vn-row:nth-child(6) .--add-icon';
const inputLocation = '.q-form input[aria-label="Location"]';
+ const createForm = {
+ prefix: '.q-dialog__inner > .column > #formModel > .q-card',
+ sufix: ' .q-field__inner > .q-field__control',
+ };
+ describe('CreateFormDialog ', () => {
+ beforeEach(() => {
+ cy.viewport(1280, 720);
+ cy.login('developer');
+ cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
+ cy.waitForElement('.q-card');
+ cy.get(createLocationButton).click();
+ });
+ it('should filter provinces based on selected country', () => {
+ // Select a country
+ cy.selectOption(
+ `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
+ 'Ecuador'
+ );
+ // Verify that provinces are filtered
+ cy.get(
+ `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
+ ).should('have.length', 1);
+
+ // Verify that towns are filtered
+ cy.get(
+ `${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
+ ).should('have.length', 1);
+ });
+
+ it('should filter towns based on selected province', () => {
+ // Select a country
+ cy.selectOption(
+ `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
+ 'Ecuador'
+ );
+ // Verify that provinces are filtered
+ cy.get(
+ `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
+ ).should('have.length', 1);
+
+ // Verify that towns are filtered
+ cy.get(
+ `${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
+ ).should('have.length', 1);
+ });
+ it('should pass selected country', () => {
+ // Select a country
+ const country = 'Ecuador';
+ const province = 'Province five';
+ cy.selectOption(
+ `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
+ country
+ );
+ cy.selectOption(
+ `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
+ province
+ );
+ cy.get(
+ `${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`
+ ).should('have.value', province);
+ });
+ });
describe('Worker Create', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/worker/create', { timeout: 5000 });
cy.waitForElement('.q-card');
+ cy.get(inputLocation).click();
});
it('Show all options', function () {
- cy.get(inputLocation).click();
cy.get(locationOptions).should('have.length.at.least', 5);
});
it('input filter location as "al"', function () {
- cy.get(inputLocation).click();
+ // cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('al');
cy.get(locationOptions).should('have.length.at.least', 4);
});
it('input filter location as "ecuador"', function () {
- cy.get(inputLocation).click();
+ // cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('ecuador');
cy.get(locationOptions).should('have.length.at.least', 1);
@@ -63,13 +128,11 @@ describe('VnLocation', () => {
cy.get(dialogInputs).eq(0).clear();
cy.get(dialogInputs).eq(0).type(postCode);
cy.selectOption(
- '.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > .q-select > .q-field__inner > .q-field__control ',
+ `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
province
);
cy.get('.q-mt-lg > .q-btn--standard').click();
- cy.get('.q-dialog__inner > .column > #formModel > .q-card').should(
- 'not.exist'
- );
+ cy.get(`${createForm.prefix}`).should('not.exist');
checkVnLocation(postCode, province);
});
it('Create city', () => {
@@ -79,7 +142,7 @@ describe('VnLocation', () => {
cy.get(dialogInputs).eq(0).type(postCode);
// city create button
cy.get(
- '.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > .q-select > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon'
+ `${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);
@@ -89,9 +152,7 @@ describe('VnLocation', () => {
});
function checkVnLocation(postCode, province) {
- cy.get('.q-dialog__inner > .column > #formModel > .q-card').should(
- 'not.exist'
- );
+ cy.get(`${createForm.prefix}`).should('not.exist');
cy.get('.q-form > .q-card > .vn-row:nth-child(6)')
.find('input')
.invoke('val')
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 43788f59f..83f45b721 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -248,3 +248,9 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => {
Cypress.Commands.add('openActionsDescriptor', () => {
cy.get('.header > :nth-child(3) > .q-btn__content > .q-icon').click();
});
+
+Cypress.Commands.add('openUserPanel', () => {
+ cy.get(
+ '.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image'
+ ).click();
+});
diff --git a/test/vitest/__tests__/components/common/VnChangePassword.spec.js b/test/vitest/__tests__/components/common/VnChangePassword.spec.js
new file mode 100644
index 000000000..f5a967bb5
--- /dev/null
+++ b/test/vitest/__tests__/components/common/VnChangePassword.spec.js
@@ -0,0 +1,70 @@
+import { createWrapper, axios } from 'app/test/vitest/helper';
+import VnChangePassword from 'src/components/common/VnChangePassword.vue';
+import { vi, beforeEach, afterEach, beforeAll, describe, expect, it } from 'vitest';
+import { Notify } from 'quasar';
+
+describe('VnSmsDialog', () => {
+ let vm;
+
+ beforeAll(() => {
+ vi.spyOn(axios, 'get').mockResolvedValue({
+ data: [],
+ });
+ vm = createWrapper(VnChangePassword, {
+ propsData: {
+ submitFn: vi.fn(),
+ },
+ }).vm;
+ });
+
+ beforeEach(() => {
+ Notify.create = vi.fn();
+ });
+
+ afterEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it('should notify when new password is empty', async () => {
+ vm.passwords.newPassword = '';
+ vm.passwords.repeatPassword = 'password';
+
+ await vm.validate();
+ expect(Notify.create).toHaveBeenCalledWith(
+ expect.objectContaining({
+ message: 'You must enter a new password',
+ type: 'negative',
+ })
+ );
+ });
+
+ it("should notify when passwords don't match", async () => {
+ vm.passwords.newPassword = 'password1';
+ vm.passwords.repeatPassword = 'password2';
+ await vm.validate();
+ expect(Notify.create).toHaveBeenCalledWith(
+ expect.objectContaining({
+ message: `Passwords don't match`,
+ type: 'negative',
+ })
+ );
+ });
+
+ describe('if passwords match', () => {
+ it('should call submitFn and emit password', async () => {
+ vm.passwords.newPassword = 'password';
+ vm.passwords.repeatPassword = 'password';
+ await vm.validate();
+ expect(vm.props.submitFn).toHaveBeenCalledWith('password', undefined);
+ });
+
+ it('should call submitFn and emit password and old password', async () => {
+ vm.passwords.newPassword = 'password';
+ vm.passwords.repeatPassword = 'password';
+ vm.passwords.oldPassword = 'oldPassword';
+
+ await vm.validate();
+ expect(vm.props.submitFn).toHaveBeenCalledWith('password', 'oldPassword');
+ });
+ });
+});