Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
commit
fdc0a856ad
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
||||
import { onBeforeRouteLeave, useRouter } from 'vue-router';
|
||||
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
@ -12,7 +12,6 @@ import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
|||
import VnConfirm from './ui/VnConfirm.vue';
|
||||
import { tMobile } from 'src/composables/tMobile';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const { push } = useRouter();
|
||||
const quasar = useQuasar();
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import EditForm from 'components/EditTableCellValueForm.vue';
|
||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||
|
||||
const fieldA = 'fieldA';
|
||||
const fieldB = 'fieldB';
|
||||
|
||||
describe('EditForm', () => {
|
||||
let vm;
|
||||
const mockRows = [
|
||||
{ id: 1, itemFk: 101 },
|
||||
{ id: 2, itemFk: 102 },
|
||||
];
|
||||
const mockFieldsOptions = [
|
||||
{ label: 'Field A', field: fieldA, component: 'input', attrs: {} },
|
||||
{ label: 'Field B', field: fieldB, component: 'date', attrs: {} },
|
||||
];
|
||||
const editUrl = '/api/edit';
|
||||
|
||||
beforeAll(() => {
|
||||
vi.spyOn(axios, 'post').mockResolvedValue({ status: 200 });
|
||||
vm = createWrapper(EditForm, {
|
||||
props: {
|
||||
rows: mockRows,
|
||||
fieldsOptions: mockFieldsOptions,
|
||||
editUrl,
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
it('should call axios.post with the correct parameters in the payload', async () => {
|
||||
const selectedField = { field: fieldA, component: 'input', attrs: {} };
|
||||
const newValue = 'Test Value';
|
||||
|
||||
vm.selectedField = selectedField;
|
||||
vm.newValue = newValue;
|
||||
|
||||
await vm.onSubmit();
|
||||
|
||||
const payload = axios.post.mock.calls[0][1];
|
||||
|
||||
expect(axios.post).toHaveBeenCalledWith(editUrl, expect.any(Object));
|
||||
expect(payload.field).toEqual(fieldA);
|
||||
expect(payload.newValue).toEqual(newValue);
|
||||
|
||||
expect(payload.lines).toEqual(expect.arrayContaining(mockRows));
|
||||
|
||||
expect(vm.isLoading).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -203,6 +203,12 @@ const onIntrastatCreated = (response, formData) => {
|
|||
v-model="data.hasKgPrice"
|
||||
:label="t('item.basicData.hasKgPrice')"
|
||||
/>
|
||||
<QCheckbox
|
||||
v-model="data.isCustomInspectionRequired"
|
||||
:label="t('item.basicData.isCustomInspectionRequired')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div>
|
||||
<QCheckbox
|
||||
v-model="data.isFragile"
|
||||
|
|
|
@ -158,6 +158,7 @@ item:
|
|||
isFragileTooltip: Is shown at website, app that this item cannot travel (wreath, palms, ...)
|
||||
isPhotoRequested: Do photo
|
||||
isPhotoRequestedTooltip: This item does need a photo
|
||||
isCustomInspectionRequired: Needs physical inspection (PIF)
|
||||
description: Description
|
||||
fixedPrice:
|
||||
itemFk: Item ID
|
||||
|
|
|
@ -160,6 +160,7 @@ item:
|
|||
isFragileTooltip: Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...)
|
||||
isPhotoRequested: Hacer foto
|
||||
isPhotoRequestedTooltip: Este artículo necesita una foto
|
||||
isCustomInspectionRequired: Necesita inspección física (PIF)
|
||||
description: Descripción
|
||||
fixedPrice:
|
||||
itemFk: ID Artículo
|
||||
|
|
|
@ -59,7 +59,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('basicData.item'),
|
||||
name: 'packagingItemFk',
|
||||
name: 'longName',
|
||||
align: 'left',
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
|
@ -321,12 +321,18 @@ onMounted(async () => {
|
|||
"
|
||||
order="created DESC"
|
||||
>
|
||||
<template #column-packagingItemFk="{ row }">
|
||||
<template #column-freightItemName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.packagingItemFk }}
|
||||
{{ row.freightItemName }}
|
||||
<ItemDescriptorProxy :id="row.packagingItemFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-longName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.longName }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
<QDialog ref="newTicketDialogRef" transition-show="scale" transition-hide="scale">
|
||||
<ExpeditionNewTicket
|
||||
|
|
|
@ -11,9 +11,8 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import EntryDescriptorProxy from '../Entry/Card/EntryDescriptorProxy.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toDate } from 'src/filters';
|
||||
import { toDate, toCurrency } from 'src/filters';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import axios from 'axios';
|
||||
|
@ -128,6 +127,10 @@ const tableColumnComponents = {
|
|||
component: 'span',
|
||||
attrs: {},
|
||||
},
|
||||
isCustomInspectionRequired: {
|
||||
component: 'span',
|
||||
attrs: {},
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -589,7 +592,16 @@ const getColor = (percentage) => {
|
|||
<QBtn flat class="link" dense>{{ entry.supplierName }}</QBtn>
|
||||
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
||||
</QTd>
|
||||
<QTd />
|
||||
<QTd>
|
||||
<QIcon
|
||||
v-if="entry.isCustomInspectionRequired"
|
||||
name="warning"
|
||||
color="negative"
|
||||
size="xs"
|
||||
:title="t('requiresInspection')"
|
||||
>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<span>{{ toCurrency(entry.invoiceAmount) }}</span>
|
||||
</QTd>
|
||||
|
@ -704,6 +716,8 @@ en:
|
|||
physicKg: Phy. KG
|
||||
shipped: W. shipped
|
||||
landed: W. landed
|
||||
requiresInspection: Requires inspection
|
||||
BIP: Boder Inspection Point
|
||||
|
||||
es:
|
||||
searchExtraCommunity: Buscar por envío extra comunitario
|
||||
|
@ -712,4 +726,6 @@ es:
|
|||
shipped: F. envío
|
||||
landed: F. llegada
|
||||
Open as PDF: Abrir como PDF
|
||||
requiresInspection: Requiere inspección
|
||||
BIP: Punto de Inspección Fronteriza
|
||||
</i18n>
|
||||
|
|
Loading…
Reference in New Issue