diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 5239fe859..b9c6edf50 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -316,6 +316,7 @@ defineExpose({ selected, CrudModelRef, params, + tableRef, }); function handleOnDataSaved(_) { @@ -815,6 +816,7 @@ es: top: 0; } } + .vnTable { thead tr th { position: sticky; diff --git a/src/components/common/VnBtnSelect.vue b/src/components/common/VnBtnSelect.vue new file mode 100644 index 000000000..b0616a6b2 --- /dev/null +++ b/src/components/common/VnBtnSelect.vue @@ -0,0 +1,19 @@ + + diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index fa0a14f45..dd0d3292f 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -308,8 +308,11 @@ globals: email: Email SSN: SSN fi: FI + 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 @@ -556,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 5dfe90e98..4e67ecdaa 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -312,8 +312,11 @@ globals: email: Correo SSN: NSS fi: NIF + myTeam: Mi equipo + departmentFk: Departamento changePass: Cambiar contraseña deleteConfirmTitle: Eliminar los elementos seleccionados + changeState: Cambiar estado errors: statusUnauthorized: Acceso denegado statusInternalServerError: Ha ocurrido un error interno del servidor @@ -565,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')" > -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) { @@ -242,9 +216,34 @@ onUnmounted(() => (stateStore.rightDrawer = false));