diff --git a/package.json b/package.json index 7be20a842..38a1d06a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.22.0", + "version": "24.24.0", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue index e3cb2874a..769ba9959 100644 --- a/src/components/common/VnDmsList.vue +++ b/src/components/common/VnDmsList.vue @@ -35,7 +35,7 @@ const $props = defineProps({ downloadModel: { type: String, required: false, - default: null, + default: undefined, }, defaultDmsCode: { type: String, diff --git a/src/pages/Worker/Card/WorkerCalendar.vue b/src/pages/Worker/Card/WorkerCalendar.vue index 2e525aa30..cfde97f93 100644 --- a/src/pages/Worker/Card/WorkerCalendar.vue +++ b/src/pages/Worker/Card/WorkerCalendar.vue @@ -170,23 +170,6 @@ watch([year, businessFk], () => refreshData()); ref="WorkerFreelanceRef" auto-load /> - import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; -import { onMounted, ref, computed } from 'vue'; -import FetchData from 'components/FetchData.vue'; -import FormModel from 'components/FormModel.vue'; -import VnSelect from 'src/components/common/VnSelect.vue'; -import useNotify from 'src/composables/useNotify.js'; -import axios from 'axios'; -import { useRole } from 'src/composables/useRole'; +import { ref, computed } from 'vue'; + +import axios from 'axios'; +import useNotify from 'src/composables/useNotify.js'; +import FetchData from 'components/FetchData.vue'; +import FormModelPopup from 'src/components/FormModelPopup.vue'; +import { useVnConfirm } from 'composables/useVnConfirm'; + +import VnPaginate from 'src/components/ui/VnPaginate.vue'; +import VnRow from 'components/ui/VnRow.vue'; +import VnSelect from 'src/components/common/VnSelect.vue'; +import VnInput from 'src/components/common/VnInput.vue'; -const route = useRoute(); const { t } = useI18n(); const { notify } = useNotify(); -const { hasAny } = useRole(); -const fetchCurrentDeviceRef = ref(null); -const deviceProductionsFilter = { - fields: ['id', 'serialNumber', 'modelFk'], - where: { stateFk: 'idle' }, - order: 'id', -}; -const deviceProductionsOptions = ref([]); -const newPDA = ref({}); -const currentPDA = ref(null); +const paginate = ref(); +const dialog = ref(); +const route = useRoute(); +const { openConfirmationModal } = useVnConfirm(); +const routeId = computed(() => route.params.id); -const isAllowedToEdit = computed(() => hasAny(['hr', 'productionAssi'])); +const initialData = computed(() => { + return { + userFk: routeId.value, + deviceProductionFk: null, + simSerialNumber: null, + }; +}); -const setCurrentPDA = (data) => { - currentPDA.value = data; - currentPDA.value.description = `ID: ${currentPDA.value.deviceProductionFk} ${t( - 'worker.pda.model' - )}: ${currentPDA.value.deviceProduction.modelFk} ${t('worker.pda.serialNumber')}: ${ - currentPDA.value.deviceProduction.serialNumber - }`; -}; - -const deallocatePDA = async (data) => { +const deallocatePDA = async (deviceProductionFk) => { try { await axios.post(`Workers/${route.params.id}/deallocatePDA`, { - pda: currentPDA.value.deviceProductionFk, + pda: deviceProductionFk, }); - data.pda = null; - currentPDA.value = null; - await fetchCurrentDeviceRef.value.fetch(); notify(t('PDA deallocated'), 'positive'); } catch (err) { console.error('Error deallocating PDA'); } + paginate.value.fetch(); }; -onMounted(async () => await fetchCurrentDeviceRef.value.fetch()); +function reloadData() { + initialData.value.deviceProductionFk = null; + initialData.value.simSerialNumber = null; + paginate.value.fetch(); +} - + es: + Remove PDA: Eliminar PDA + Do you want to remove this PDA?: ¿Desea eliminar este PDA? PDA deallocated: PDA desasignada + SIM serial number: Número de serie de la SIM + Model: Modelo + This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario + Add new device: Añadir nuevo dispositivo diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue index d0b91e3a7..d9a650d9a 100644 --- a/src/pages/Worker/Card/WorkerTimeControl.vue +++ b/src/pages/Worker/Card/WorkerTimeControl.vue @@ -489,23 +489,6 @@ onMounted(async () => { -
diff --git a/test/cypress/integration/worker/workerPda.spec.js b/test/cypress/integration/worker/workerPda.spec.js new file mode 100644 index 000000000..9af994a70 --- /dev/null +++ b/test/cypress/integration/worker/workerPda.spec.js @@ -0,0 +1,24 @@ +describe('WorkerPda', () => { + const deviceProductionField = + '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'; + beforeEach(() => { + cy.viewport(1920, 1080); + cy.login('developer'); + cy.visit(`/#/worker/1110/pda`); + }); + + it('assign pda', () => { + cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); + cy.get(deviceProductionField).type('{downArrow}{enter}'); + cy.get('.vn-row > #simSerialNumber').type('123{enter}'); + cy.get('.q-notification__message').should('have.text', 'Data created'); + }); + + it('delete pda', () => { + cy.get('.q-card > .q-item > .q-item__section--side > .q-icon').click(); + cy.get( + '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' + ).click(); + cy.get('.q-notification__message').should('have.text', 'PDA deallocated'); + }); +});