diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 8c4f70f3b..6303f48ae 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -181,9 +181,8 @@ async function saveChanges(data) { return; } let changes = data || getChanges(); - if ($props.beforeSaveFn) { - changes = await $props.beforeSaveFn(changes, getChanges); - } + if ($props.beforeSaveFn) changes = await $props.beforeSaveFn(changes, getChanges); + try { if (changes?.creates?.length === 0 && changes?.updates?.length === 0) { return; @@ -194,7 +193,7 @@ async function saveChanges(data) { isLoading.value = false; } originalData.value = JSON.parse(JSON.stringify(formData.value)); - if (changes.creates?.length) await vnPaginateRef.value.fetch(); + if (changes?.creates?.length) await vnPaginateRef.value.fetch(); hasChanges.value = false; emit('saveChanges', data); diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 78b00d041..6a547d95d 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -595,18 +595,17 @@ function cardClick(_, row) { function removeTextValue(data, getChanges) { let changes = data.updates; - if (!changes) return data; - - for (const change of changes) { - for (const key in change.data) { - if (key.endsWith('VnTableTextValue')) { - delete change.data[key]; + if (changes) { + for (const change of changes) { + for (const key in change.data) { + if (key.endsWith('VnTableTextValue')) { + delete change.data[key]; + } } } + + data.updates = changes.filter((change) => Object.keys(change.data).length > 0); } - - data.updates = changes.filter((change) => Object.keys(change.data).length > 0); - if ($attrs?.beforeSaveFn) data = $attrs.beforeSaveFn(data, getChanges); return data; @@ -776,7 +775,7 @@ const rowCtrlClickFunction = computed(() => { :data-col-field="col?.name" >
cols.visible ?? true)" :key="col?.id" :class="getColAlign(col)" + :style="col?.width ? `max-width: ${col?.width}` : ''" + style="font-size: small" > { @on-data-saved="(_, res) => createForm.onDataSaved(res)" > diff --git a/src/components/common/VnDms.vue b/src/components/common/VnDms.vue index 35308c2c4..bee300f4e 100644 --- a/src/components/common/VnDms.vue +++ b/src/components/common/VnDms.vue @@ -177,6 +177,7 @@ function addDefaultData(data) { name="vn:attach" class="cursor-pointer" @click="inputFileRef.pickFiles()" + data-cy="attachFile" > {{ t('globals.selectFile') }} diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue index 424781a26..aafa9f4ba 100644 --- a/src/components/common/VnDmsList.vue +++ b/src/components/common/VnDmsList.vue @@ -389,10 +389,7 @@ defineExpose({
-
+
{{ t('No data to display') }}
@@ -416,6 +413,7 @@ defineExpose({ v-shortcut @click="showFormDialog()" class="fill-icon" + data-cy="addButton" > {{ t('Upload file') }} diff --git a/src/pages/Entry/Card/EntryBasicData.vue b/src/pages/Entry/Card/EntryBasicData.vue index 6462ed24a..34e4a0f9c 100644 --- a/src/pages/Entry/Card/EntryBasicData.vue +++ b/src/pages/Entry/Card/EntryBasicData.vue @@ -13,6 +13,7 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnSelectTravelExtended from 'src/components/common/VnSelectTravelExtended.vue'; import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue'; +import VnCheckbox from 'src/components/common/VnCheckbox.vue'; const route = useRoute(); const { t } = useI18n(); @@ -53,7 +54,7 @@ onMounted(() => { :clear-store-on-unmount="false" > es: + Buyer: Comprador + Family: Familia Article: Artículo Siz.: Med. Size: Medida diff --git a/src/pages/Entry/Card/EntryNotes.vue b/src/pages/Entry/Card/EntryNotes.vue index 459c3b069..4159ed5ca 100644 --- a/src/pages/Entry/Card/EntryNotes.vue +++ b/src/pages/Entry/Card/EntryNotes.vue @@ -2,153 +2,82 @@ import { ref, computed } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; - -import FetchData from 'components/FetchData.vue'; -import CrudModel from 'components/CrudModel.vue'; -import VnInput from 'src/components/common/VnInput.vue'; -import VnSelect from 'src/components/common/VnSelect.vue'; +import VnTable from 'src/components/VnTable/VnTable.vue'; const { params } = useRoute(); const { t } = useI18n(); - +const selectedRows = ref([]); const entryObservationsRef = ref(null); -const entryObservationsOptions = ref([]); -const selected = ref([]); - -const sortEntryObservationOptions = (data) => { - entryObservationsOptions.value = [...data].sort((a, b) => - a.description.localeCompare(b.description), - ); -}; - +const entityId = ref(params.id); const columns = computed(() => [ { - name: 'observationType', - label: t('entry.notes.observationType'), - field: (row) => row.observationTypeFk, - sortable: true, - options: entryObservationsOptions.value, - required: true, - model: 'observationTypeFk', - optionValue: 'id', - optionLabel: 'description', - tabIndex: 1, - align: 'left', + name: 'id', + isId: true, + visible: false, + isEditable: false, + columnFilter: false, }, { + name: 'observationTypeFk', + label: t('entry.notes.observationType'), + component: 'select', + columnFilter: { inWhere: true }, + attrs: { + inWhere: true, + url: 'ObservationTypes', + fields: ['id', 'description'], + optionValue: 'id', + optionLabel: 'description', + sortBy: 'description', + }, + width: '30px', + create: true, + }, + { + align: 'left', name: 'description', label: t('globals.description'), - field: (row) => row.description, - tabIndex: 2, - align: 'left', + component: 'input', + columnFilter: false, + attrs: { autogrow: true }, + create: true, }, ]); + +const filter = computed(() => ({ + fields: ['id', 'entryFk', 'observationTypeFk', 'description'], + include: ['observationType'], + where: { entryFk: entityId }, +})); es: - Add note: Añadir nota - Remove note: Quitar nota + Create note: Crear nota diff --git a/src/pages/Entry/Card/EntrySummary.vue b/src/pages/Entry/Card/EntrySummary.vue index c40e2ba46..53967e66f 100644 --- a/src/pages/Entry/Card/EntrySummary.vue +++ b/src/pages/Entry/Card/EntrySummary.vue @@ -92,13 +92,13 @@ onMounted(async () => {
{ size="xs" /> @@ -102,6 +102,7 @@ const entryFilterPanel = ref(); v-model="params.landed" @update:model-value="searchFn()" is-outlined + data-cy="landed" /> @@ -121,13 +122,6 @@ const entryFilterPanel = ref(); rounded /> - - - @@ -171,6 +165,7 @@ const entryFilterPanel = ref(); @update:model-value="searchFn()" url="Warehouses" :fields="['id', 'name']" + sort-by="name ASC" hide-selected dense outlined @@ -186,6 +181,7 @@ const entryFilterPanel = ref(); @update:model-value="searchFn()" url="Warehouses" :fields="['id', 'name']" + sort-by="name ASC" hide-selected dense outlined @@ -233,15 +229,6 @@ const entryFilterPanel = ref(); /> - - - - - @@ -267,7 +254,7 @@ en: hasToShowDeletedEntries: Show deleted entries es: params: - isExcludedFromAvailable: Inventario + isExcludedFromAvailable: Excluida isOrdered: Pedida isConfirmed: Confirmado isReceived: Recibida diff --git a/src/pages/Entry/EntryLatestBuys.vue b/src/pages/Entry/EntryLatestBuys.vue deleted file mode 100644 index 73fdcbbbf..000000000 --- a/src/pages/Entry/EntryLatestBuys.vue +++ /dev/null @@ -1,264 +0,0 @@ - - - diff --git a/src/pages/Entry/EntryLatestBuysFilter.vue b/src/pages/Entry/EntryLatestBuysFilter.vue deleted file mode 100644 index 19b457524..000000000 --- a/src/pages/Entry/EntryLatestBuysFilter.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - diff --git a/src/pages/Entry/EntryList.vue b/src/pages/Entry/EntryList.vue index 3b5434cb8..5ebad3144 100644 --- a/src/pages/Entry/EntryList.vue +++ b/src/pages/Entry/EntryList.vue @@ -107,9 +107,8 @@ const columns = computed(() => [ attrs: { url: 'suppliers', fields: ['id', 'name'], - where: { order: 'name DESC' }, + sortBy: 'name ASC', }, - format: (row, dashIfEmpty) => dashIfEmpty(row.supplierName), width: '110px', }, { @@ -145,6 +144,7 @@ const columns = computed(() => [ attrs: { url: 'agencyModes', fields: ['id', 'name'], + sortBy: 'name ASC', }, columnField: { component: null, @@ -158,7 +158,6 @@ const columns = computed(() => [ component: 'input', }, { - align: 'left', label: t('entry.list.tableVisibleColumns.warehouseOutFk'), name: 'warehouseOutFk', cardVisible: true, @@ -166,6 +165,7 @@ const columns = computed(() => [ attrs: { url: 'warehouses', fields: ['id', 'name'], + sortBy: 'name ASC', }, columnField: { component: null, @@ -174,7 +174,6 @@ const columns = computed(() => [ width: '65px', }, { - align: 'left', label: t('entry.list.tableVisibleColumns.warehouseInFk'), name: 'warehouseInFk', cardVisible: true, @@ -182,6 +181,7 @@ const columns = computed(() => [ attrs: { url: 'warehouses', fields: ['id', 'name'], + sortBy: 'name ASC', }, columnField: { component: null, @@ -190,7 +190,6 @@ const columns = computed(() => [ width: '65px', }, { - align: 'left', labelAbbreviation: t('Type'), label: t('entry.list.tableVisibleColumns.entryTypeDescription'), toolTip: t('entry.list.tableVisibleColumns.entryTypeDescription'), @@ -201,6 +200,7 @@ const columns = computed(() => [ fields: ['code', 'description'], optionValue: 'code', optionLabel: 'description', + sortBy: 'description', }, width: '65px', format: (row, dashIfEmpty) => dashIfEmpty(row.entryTypeDescription), diff --git a/src/pages/Entry/EntryStockBought.vue b/src/pages/Entry/EntryStockBought.vue index 41f78617c..5da51d5a6 100644 --- a/src/pages/Entry/EntryStockBought.vue +++ b/src/pages/Entry/EntryStockBought.vue @@ -1,24 +1,23 @@