diff --git a/src/components/VnSelectProvince.vue b/src/components/VnSelectProvince.vue index 606799e50..9fcbef11e 100644 --- a/src/components/VnSelectProvince.vue +++ b/src/components/VnSelectProvince.vue @@ -1,5 +1,5 @@ + + + + + diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 8fd495e68..877a39546 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -304,13 +304,15 @@ globals: from: From To: To stateFk: State - departmentFk: Department email: Email SSN: SSN fi: FI packing: ITP + myTeam: My team + departmentFk: Department changePass: Change password deleteConfirmTitle: Delete selected elements + changeState: Change state errors: statusUnauthorized: Access denied statusInternalServerError: An internal server error has ocurred @@ -557,7 +559,6 @@ ticket: package: Package taxClass: Tax class services: Services - changeState: Change state requester: Requester atender: Atender request: Request diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index f777089a6..ab73e3187 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -312,9 +312,11 @@ globals: email: Correo SSN: NSS fi: NIF + myTeam: Mi equipo packing: ITP changePass: Cambiar contraseña deleteConfirmTitle: Eliminar los elementos seleccionados + changeState: Cambiar estado errors: statusUnauthorized: Acceso denegado statusInternalServerError: Ha ocurrido un error interno del servidor @@ -566,7 +568,6 @@ ticket: package: Embalaje taxClass: Tipo IVA services: Servicios - changeState: Cambiar estado requester: Solicitante atender: Comprador request: Petición de compra diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index d77f718c6..edfa52b4b 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -204,7 +204,7 @@ function claimUrl(section) { top color="black" text-color="white" - :label="t('ticket.summary.changeState')" + :label="t('globals.changeState')" > { + > + + + + {{ scope.opt?.name }} + {{ scope.opt?.nickname }}, + {{ scope.opt?.code }} + + + + diff --git a/src/pages/Item/ItemTypeCreate.vue b/src/pages/Item/ItemTypeCreate.vue index 290a40389..60c037510 100644 --- a/src/pages/Item/ItemTypeCreate.vue +++ b/src/pages/Item/ItemTypeCreate.vue @@ -52,15 +52,27 @@ const redirectToItemTypeBasicData = (_, { id }) => { + > + + + {{ scope.opt?.name }} + {{ scope.opt?.nickname }}, + {{ scope.opt?.code }} + + + + + > + + + {{ scope.opt?.name }} + {{ scope.opt?.nickname }}, + {{ scope.opt?.code }} + + + -import { onMounted, ref, computed, onUnmounted, watch } from 'vue'; +import { onMounted, ref, computed, onUnmounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; @@ -15,6 +15,8 @@ import useNotify from 'src/composables/useNotify.js'; import { toDateTimeFormat } from 'src/filters/date'; import axios from 'axios'; import VnTable from 'src/components/VnTable/VnTable.vue'; +import VnBtnSelect from 'src/components/common/VnBtnSelect.vue'; +import FetchData from 'src/components/FetchData.vue'; const route = useRoute(); const stateStore = useStateStore(); @@ -23,50 +25,24 @@ const { notify } = useNotify(); const { openConfirmationModal } = useVnConfirm(); const newTicketDialogRef = ref(null); const logsTableDialogRef = ref(null); -const tableRef = ref(); +const vnTableRef = ref(); const expeditionsLogsData = ref([]); const selectedExpeditions = ref([]); const allColumnNames = ref([]); const newTicketWithRoute = ref(false); const selectedRows = ref([]); const hasSelectedRows = computed(() => selectedRows.value.length > 0); - -const exprBuilder = (param, value) => { - switch (param) { - case 'expeditionFk': - return { id: value }; - case 'packageItemName': - return { packagingItemFk: value }; - } -}; +const expeditionStateTypes = ref([]); const expeditionsFilter = computed(() => ({ where: { ticketFk: route.params.id }, order: ['created DESC'], })); -const expeditionsArrayData = useArrayData('ticketExpeditions', { - url: 'Expeditions/filter', - filter: expeditionsFilter.value, - exprBuilder: exprBuilder, -}); - const ticketArrayData = useArrayData('ticketData'); const ticketStore = ticketArrayData.store; const ticketData = computed(() => ticketStore.data); -const refetchExpeditions = async () => { - await expeditionsArrayData.applyFilter({ - filter: expeditionsFilter.value, - }); -}; - -watch( - () => route.params.id, - async () => await refetchExpeditions(), - { immediate: true } -); - const columns = computed(() => [ { align: 'left', @@ -188,12 +164,10 @@ const showNewTicketDialog = (withRoute = false) => { const deleteExpedition = async () => { try { - const expeditionIds = selectedExpeditions.value.map( - (expedition) => expedition.id - ); + const expeditionIds = selectedRows.value.map((expedition) => expedition.id); const params = { expeditionIds }; await axios.post('Expeditions/deleteExpeditions', params); - await refetchExpeditions(); + vnTableRef.value.reload(); selectedExpeditions.value = []; notify(t('expedition.expeditionRemoved'), 'positive'); } catch (error) { @@ -216,17 +190,11 @@ const getExpeditionState = async (expedition) => { const { data: expeditionStates } = await axios.get(`ExpeditionStates/filter`, { params: { filter: JSON.stringify(filter) }, }); - const { data: scannedStates } = await axios.get(`ExpeditionStates`, { - params: { filter: JSON.stringify(filter), fields: ['id', 'isScanned'] }, - }); - expeditionsLogsData.value = expeditionStates.map((state) => { - const scannedState = scannedStates.find((s) => s.id === state.id); - return { - ...state, - isScanned: scannedState ? scannedState.isScanned : false, - }; - }); + expeditionsLogsData.value = expeditionStates.map((state) => ({ + ...state, + isScanned: !!state.isScanned, + })); } catch (error) { console.error(error); } @@ -242,9 +210,35 @@ onUnmounted(() => (stateStore.rightDrawer = false)); + (expeditionStateTypes = data)" + auto-load + /> + (stateStore.rightDrawer = false)); - (stateStore.rightDrawer = false)); selection: 'multiple', }" auto-load + :expr-builder=" + (param, value) => { + switch (param) { + case 'expeditionFk': + return { id: value }; + case 'packageItemName': + return { packagingItemFk: value }; + } + } + " order="created DESC" > @@ -324,7 +328,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); @@ -345,11 +349,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); - - {{ - row.isScanned === 1 ? t('expedition.yes') : t('expedition.no') - }} - + diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue index 1e14b0402..5fb99b849 100644 --- a/src/pages/Ticket/Card/TicketSummary.vue +++ b/src/pages/Ticket/Card/TicketSummary.vue @@ -122,37 +122,23 @@ function isOnTicketCard() { - - - - - - - - - - + + + diff --git a/src/pages/Ticket/TicketAdvance.vue b/src/pages/Ticket/TicketAdvance.vue index 43b500dc0..7ac602679 100644 --- a/src/pages/Ticket/TicketAdvance.vue +++ b/src/pages/Ticket/TicketAdvance.vue @@ -463,6 +463,9 @@ onMounted(async () => { userParams.dateToAdvance = today; userParams.scopeDays = 1; userParams.warehouseFk = user.value.warehouseFk; + userParams.ipt = 'H'; + userParams.futureIpt = 'H'; + userParams.isFullMovable = true; const filter = { limit: 0 }; await arrayData.addFilter({ filter, userParams }); }); diff --git a/src/pages/Ticket/TicketAdvanceFilter.vue b/src/pages/Ticket/TicketAdvanceFilter.vue index b25ebdea6..21587dab3 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, @@ -43,6 +43,11 @@ const getItemPackingTypes = async () => { } }; +const getLocale = (val) => { + const param = `params.${val}`; + return te(param) ? t(param) : t(`globals.${param}`); +}; + onMounted(async () => await getItemPackingTypes()); @@ -60,7 +65,7 @@ onMounted(async () => await getItemPackingTypes()); > - {{ t(`params.${tag.label}`) }}: + {{ getLocale(tag.label) }}: {{ formatFn(tag.value) }} @@ -136,6 +141,19 @@ onMounted(async () => await getItemPackingTypes()); /> + + + + + + +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/support/commands.js b/test/cypress/support/commands.js index 83f45b721..8d48dc71a 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');