diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue
index b78c99b8a..ee94a1d81 100644
--- a/src/components/common/VnSelect.vue
+++ b/src/components/common/VnSelect.vue
@@ -205,10 +205,10 @@ function filter(val, options) {
}
if (!row) return;
- const id = row[$props.optionValue];
+ const id = String(row[$props.optionValue]);
const optionLabel = String(row[$props.optionLabel]).toLowerCase();
- return id == search || optionLabel.includes(search);
+ return id.includes(search) || optionLabel.includes(search);
});
}
diff --git a/src/components/common/VnSelectWorker.vue b/src/components/common/VnSelectWorker.vue
index b0fef4443..9a8151a3d 100644
--- a/src/components/common/VnSelectWorker.vue
+++ b/src/components/common/VnSelectWorker.vue
@@ -51,6 +51,7 @@ const url = computed(() => {
option-value="id"
option-label="nickname"
:fields="['id', 'name', 'nickname', 'code']"
+ :filter-options="['id', 'name', 'nickname', 'code']"
sort-by="nickname ASC"
>
@@ -71,7 +72,7 @@ const url = computed(() => {
{{ scope.opt.nickname }}
- {{ scope.opt.nickname }}, {{ scope.opt.code }}
+ #{{ scope.opt.id }}, {{ scope.opt.nickname }}, {{ scope.opt.code }}
diff --git a/src/components/common/__tests__/VnNotes.spec.js b/src/components/common/__tests__/VnNotes.spec.js
new file mode 100644
index 000000000..8f24a7f14
--- /dev/null
+++ b/src/components/common/__tests__/VnNotes.spec.js
@@ -0,0 +1,107 @@
+import { describe, it, expect, vi, beforeAll, afterEach, beforeEach } from 'vitest';
+import { createWrapper, axios } from 'app/test/vitest/helper';
+import VnNotes from 'src/components/ui/VnNotes.vue';
+
+describe('VnNotes', () => {
+ let vm;
+ let wrapper;
+ let spyFetch;
+ let postMock;
+ let expectedBody;
+ const mockData= {name: 'Tony', lastName: 'Stark', text: 'Test Note', observationTypeFk: 1};
+
+ function generateExpectedBody() {
+ expectedBody = {...vm.$props.body, ...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk }};
+ }
+
+ async function setTestParams(text, observationType, type){
+ vm.newNote.text = text;
+ vm.newNote.observationTypeFk = observationType;
+ wrapper.setProps({ selectType: type });
+ }
+
+ beforeAll(async () => {
+ vi.spyOn(axios, 'get').mockReturnValue({ data: [] });
+
+ wrapper = createWrapper(VnNotes, {
+ propsData: {
+ url: '/test',
+ body: { name: 'Tony', lastName: 'Stark' },
+ }
+ });
+ wrapper = wrapper.wrapper;
+ vm = wrapper.vm;
+ });
+
+ beforeEach(() => {
+ postMock = vi.spyOn(axios, 'post').mockResolvedValue(mockData);
+ spyFetch = vi.spyOn(vm.vnPaginateRef, 'fetch').mockImplementation(() => vi.fn());
+ });
+
+ afterEach(() => {
+ vi.clearAllMocks();
+ expectedBody = {};
+ });
+
+ describe('insert', () => {
+ it('should not call axios.post and vnPaginateRef.fetch if newNote.text is null', async () => {
+ await setTestParams( null, null, true );
+
+ await vm.insert();
+
+ expect(postMock).not.toHaveBeenCalled();
+ expect(spyFetch).not.toHaveBeenCalled();
+ });
+
+ it('should not call axios.post and vnPaginateRef.fetch if newNote.text is empty', async () => {
+ await setTestParams( "", null, false );
+
+ await vm.insert();
+
+ expect(postMock).not.toHaveBeenCalled();
+ expect(spyFetch).not.toHaveBeenCalled();
+ });
+
+ it('should not call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is true', async () => {
+ await setTestParams( "Test Note", null, true );
+
+ await vm.insert();
+
+ expect(postMock).not.toHaveBeenCalled();
+ expect(spyFetch).not.toHaveBeenCalled();
+ });
+
+ it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is false', async () => {
+ await setTestParams( "Test Note", null, false );
+
+ generateExpectedBody();
+
+ await vm.insert();
+
+ expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
+ expect(spyFetch).toHaveBeenCalled();
+ });
+
+ it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is setted and selectType is false', async () => {
+ await setTestParams( "Test Note", 1, false );
+
+ generateExpectedBody();
+
+ await vm.insert();
+
+ expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
+ expect(spyFetch).toHaveBeenCalled();
+ });
+
+ it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
+ await setTestParams( "Test Note", 1, true );
+
+ generateExpectedBody();
+
+ await vm.insert();
+
+ expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
+ expect(spyFetch).toHaveBeenCalled();
+ });
+ });
+});
\ No newline at end of file
diff --git a/src/pages/Claim/ClaimFilter.vue b/src/pages/Claim/ClaimFilter.vue
index c28e95cb8..b4dd4ee1b 100644
--- a/src/pages/Claim/ClaimFilter.vue
+++ b/src/pages/Claim/ClaimFilter.vue
@@ -93,16 +93,7 @@ defineExpose({ states });
outlined
rounded
dense
- >
-
-
-
- #{{ scope.opt?.id }}
- {{ scope.opt?.name }}
-
-
-
-
+ />
- {{
- scope.opt?.name + ': ' + scope.opt?.nickname
- }}
+
+ {{ scope.opt?.name}}
+
+
+ {{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
+
diff --git a/src/pages/Entry/EntryLatestBuysFilter.vue b/src/pages/Entry/EntryLatestBuysFilter.vue
index dbca58131..59dddce26 100644
--- a/src/pages/Entry/EntryLatestBuysFilter.vue
+++ b/src/pages/Entry/EntryLatestBuysFilter.vue
@@ -69,12 +69,14 @@ const tagValues = ref([]);
use-input
@update:model-value="searchFn()"
>
-
-
+
+
- {{ opt.name }}
+
+ {{ scope.opt?.name}}
+
- {{ opt.nickname }}
+ {{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue
index 653692026..6259030e0 100644
--- a/src/pages/InvoiceIn/InvoiceInFilter.vue
+++ b/src/pages/InvoiceIn/InvoiceInFilter.vue
@@ -68,13 +68,26 @@ function handleDaysAgo(params, daysAgo) {
+ >
+
+
+
+
+ {{ scope.opt?.name}}
+
+
+ {{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
+
+
+
+
+
diff --git a/src/pages/InvoiceIn/InvoiceInList.vue b/src/pages/InvoiceIn/InvoiceInList.vue
index 43b9f2c11..2d8fb2989 100644
--- a/src/pages/InvoiceIn/InvoiceInList.vue
+++ b/src/pages/InvoiceIn/InvoiceInList.vue
@@ -165,18 +165,18 @@ const cols = computed(() => [
{{ scope.opt?.nickname }}
- #{{ scope.opt?.id }}
+ #{{ scope.opt?.id }}, {{ scope.opt?.name }}
diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
index e6c689523..4e70d4f43 100644
--- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
+++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue
@@ -101,17 +101,7 @@ onMounted(async () => {
dense
outlined
rounded
- >
-
-
-
-
- #{{ scope.opt?.id }} {{ scope.opt?.name }}
-
-
-
-
-
+ />
rowsSelected.value.length > 0);
const rowsSelected = ref([]);
const itemFixedPriceFilterRef = ref();
@@ -368,9 +369,9 @@ function handleOnDataSave({ CrudModelRef }) {
-
+
confirmRemove(row, true)"
:title="t('globals.remove')"
- v-if="rowsSelected.length"
/>
diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue
index cb29aef1f..1d6e69339 100644
--- a/src/pages/Item/ItemList.vue
+++ b/src/pages/Item/ItemList.vue
@@ -142,6 +142,17 @@ const columns = computed(() => [
label: t('item.list.typeName'),
name: 'typeName',
align: 'left',
+ component: 'select',
+ columnFilter: {
+ name: 'typeFk',
+ attrs: {
+ url: 'ItemTypes',
+ fields: ['id', 'name'],
+ },
+ },
+ columnField: {
+ component: null,
+ }
},
{
label: t('item.list.category'),
diff --git a/src/pages/Item/ItemListFilter.vue b/src/pages/Item/ItemListFilter.vue
index 484265b49..a8349c935 100644
--- a/src/pages/Item/ItemListFilter.vue
+++ b/src/pages/Item/ItemListFilter.vue
@@ -199,17 +199,7 @@ onMounted(async () => {
dense
outlined
rounded
- >
-
-
-
- {{
- t(`params.${scope.opt?.name}`)
- }}
-
-
-
-
+ />
@@ -265,6 +255,7 @@ onMounted(async () => {
option-value="id"
option-label="name"
:fields="['id', 'name', 'nickname']"
+ :filter-options="['id', 'name', 'nickname']"
sort-by="name ASC"
hide-selected
dense
@@ -274,9 +265,12 @@ onMounted(async () => {
- {{
- scope.opt?.name + ': ' + scope.opt?.nickname
- }}
+
+ {{ scope.opt?.name}}
+
+
+ {{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
+
@@ -375,6 +369,7 @@ onMounted(async () => {
:model-value="fieldFilter.selectedField"
:options="moreFields"
option-label="label"
+ option-value="label"
dense
outlined
rounded
diff --git a/src/pages/Item/ItemRequestFilter.vue b/src/pages/Item/ItemRequestFilter.vue
index f23cadcad..af48f7f5c 100644
--- a/src/pages/Item/ItemRequestFilter.vue
+++ b/src/pages/Item/ItemRequestFilter.vue
@@ -149,7 +149,6 @@ onMounted(async () => {
:label="t('params.requesterFk')"
v-model="params.requesterFk"
@update:model-value="searchFn()"
- :fields="['id', 'name']"
:params="{ departmentCodes: ['VT'] }"
hide-selected
dense
diff --git a/src/pages/Monitor/Ticket/MonitorTickets.vue b/src/pages/Monitor/Ticket/MonitorTickets.vue
index ef03ec20d..f363f5bf8 100644
--- a/src/pages/Monitor/Ticket/MonitorTickets.vue
+++ b/src/pages/Monitor/Ticket/MonitorTickets.vue
@@ -110,15 +110,13 @@ const columns = computed(() => [
name: 'salesPersonFk',
field: 'userName',
align: 'left',
- optionFilter: 'firstName',
columnFilter: {
component: 'select',
attrs: {
- url: 'Workers/activeWithInheritedRole',
- fields: ['id', 'name'],
+ url: 'Workers/search?departmentCodes=["VT"]',
+ fields: ['id', 'name', 'nickname', 'code'],
sortBy: 'nickname ASC',
- where: { role: 'salesPerson' },
- useLike: false,
+ optionLabel: 'nickname',
},
},
},
diff --git a/src/pages/Order/Card/OrderFilter.vue b/src/pages/Order/Card/OrderFilter.vue
index fcd1ef2e4..c387be241 100644
--- a/src/pages/Order/Card/OrderFilter.vue
+++ b/src/pages/Order/Card/OrderFilter.vue
@@ -97,6 +97,7 @@ const sourceList = ref([]);
v-model="params.sourceApp"
:options="sourceList"
option-label="value"
+ option-value="value"
dense
outlined
rounded
diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue
index 9c8b9f1a3..7dcb834d2 100644
--- a/src/pages/Ticket/TicketFilter.vue
+++ b/src/pages/Ticket/TicketFilter.vue
@@ -101,7 +101,7 @@ const getGroupedStates = (data) => {
- {
- {
- {
- {
-
+ >
+
+
+
+
+ {{ scope.opt?.name}}
+
+
+ {{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
+
+
+
+
+
@@ -232,6 +245,7 @@ warehouses();
:options="continentsOptions"
option-value="code"
option-label="name"
+ :filter-options="['code', 'name']"
hide-selected
dense
outlined
diff --git a/src/pages/Travel/TravelFilter.vue b/src/pages/Travel/TravelFilter.vue
index bb78080ef..90901ee4d 100644
--- a/src/pages/Travel/TravelFilter.vue
+++ b/src/pages/Travel/TravelFilter.vue
@@ -140,10 +140,10 @@ en:
Id: Contains
ref: Reference
agency: Agency
- warehouseInFk: W. In
+ warehouseInFk: Warehouse In
shipped: Shipped
shipmentHour: Shipment Hour
- warehouseOut: W. Out
+ warehouseOut: Warehouse Out
landed: Landed
landingHour: Landing Hour
totalEntries: Σ
@@ -156,7 +156,7 @@ es:
warehouseInFk: Alm.Entrada
shipped: F.Envío
shipmentHour: Hora de envío
- warehouseOut: Alm.Entrada
+ warehouseOut: Alm.Salida
landed: F.Entrega
landingHour: Hora de entrega
totalEntries: Σ