Merge branch 'dev' into warmFix_invoiceOut_Global
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
2b02c9fbd3
|
@ -272,6 +272,7 @@ defineExpose({
|
|||
hasChanges,
|
||||
reset,
|
||||
fetch,
|
||||
formData,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
@ -331,6 +331,20 @@ function handleScroll() {
|
|||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
}
|
||||
|
||||
function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||
if (evt?.shiftKey && added) {
|
||||
const rowIndex = selectedRows[0].$index;
|
||||
const selectedIndexes = new Set(selected.value.map((row) => row.$index));
|
||||
for (const row of rows) {
|
||||
if (row.$index == rowIndex) break;
|
||||
if (!selectedIndexes.has(row.$index)) {
|
||||
selected.value.push(row);
|
||||
selectedIndexes.add(row.$index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer
|
||||
|
@ -431,6 +445,7 @@ function handleScroll() {
|
|||
@virtual-scroll="handleScroll"
|
||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||
@update:selected="emit('update:selected', $event)"
|
||||
@selection="(details) => handleSelection(details, rows)"
|
||||
>
|
||||
<template #top-left v-if="!$props.withoutHeader">
|
||||
<slot name="top-left"></slot>
|
||||
|
|
|
@ -31,6 +31,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const warehouses = ref();
|
||||
|
@ -43,7 +47,8 @@ const dms = ref({});
|
|||
onMounted(() => {
|
||||
defaultData();
|
||||
if (!$props.formInitialData)
|
||||
dms.value.description = t($props.model + 'Description', dms.value);
|
||||
dms.value.description =
|
||||
$props.description ?? t($props.model + 'Description', dms.value);
|
||||
});
|
||||
function onFileChange(files) {
|
||||
dms.value.hasFileAttached = !!files;
|
||||
|
@ -54,7 +59,6 @@ function mapperDms(data) {
|
|||
const formData = new FormData();
|
||||
const { files } = data;
|
||||
if (files) formData.append(files?.name, files);
|
||||
delete data.files;
|
||||
|
||||
const dms = {
|
||||
hasFile: !!data.hasFile,
|
||||
|
@ -78,6 +82,7 @@ async function save() {
|
|||
const body = mapperDms(dms.value);
|
||||
const response = await axios.post(getUrl(), body[0], body[1]);
|
||||
emit('onDataSaved', body[1].params, response);
|
||||
delete dms.value.files;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -165,6 +170,7 @@ function addDefaultData(data) {
|
|||
@update:model-value="onFileChange(dms.files)"
|
||||
class="required"
|
||||
:display-value="dms.file"
|
||||
data-cy="VnDms_inputFile"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
|
|
@ -27,6 +27,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
emptyToNull: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
const { validations } = useValidator();
|
||||
|
||||
|
@ -39,6 +43,7 @@ const value = computed({
|
|||
return $props.modelValue;
|
||||
},
|
||||
set(value) {
|
||||
if ($props.emptyToNull && value === '') value = null;
|
||||
emit('update:modelValue', value);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -167,6 +167,7 @@ const toModule = computed(() =>
|
|||
icon="more_vert"
|
||||
round
|
||||
size="md"
|
||||
data-cy="descriptor-more-opts"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
|
|
|
@ -103,6 +103,7 @@ function cancel() {
|
|||
@click="confirm()"
|
||||
unelevated
|
||||
autofocus
|
||||
data-cy="VnConfirm_confirm"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -3,8 +3,6 @@ import { ref, computed } from 'vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
@ -12,15 +10,15 @@ import FetchData from 'src/components/FetchData.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnDms from 'src/components/common/VnDms.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
|
||||
const dms = ref({});
|
||||
const route = useRoute();
|
||||
const quasar = useQuasar();
|
||||
const editDownloadDisabled = ref(false);
|
||||
const arrayData = useArrayData();
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
const userConfig = ref(null);
|
||||
const invoiceId = computed(() => +route.params.id);
|
||||
|
||||
|
@ -36,98 +34,25 @@ const warehousesRef = ref();
|
|||
const allowTypesRef = ref();
|
||||
const allowedContentTypes = ref([]);
|
||||
const sageWithholdings = ref([]);
|
||||
const inputFileRef = ref();
|
||||
const editDmsRef = ref();
|
||||
const createDmsRef = ref();
|
||||
const documentDialogRef = ref({});
|
||||
const invoiceInRef = ref({});
|
||||
|
||||
async function checkFileExists(dmsId) {
|
||||
if (!dmsId) return;
|
||||
try {
|
||||
await axios.get(`Dms/${dmsId}`, { fields: ['id'] });
|
||||
editDownloadDisabled.value = false;
|
||||
} catch (e) {
|
||||
editDownloadDisabled.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
async function setEditDms(dmsId) {
|
||||
const { data } = await axios.get(`Dms/${dmsId}`);
|
||||
dms.value = {
|
||||
warehouseId: data.warehouseFk,
|
||||
companyId: data.companyFk,
|
||||
dmsTypeId: data.dmsTypeFk,
|
||||
...data,
|
||||
};
|
||||
|
||||
if (!allowedContentTypes.value.length) await allowTypesRef.value.fetch();
|
||||
|
||||
editDmsRef.value.show();
|
||||
}
|
||||
|
||||
async function setCreateDms() {
|
||||
const { data } = await axios.get('DmsTypes/findOne', {
|
||||
where: { code: 'invoiceIn' },
|
||||
function deleteFile(dmsFk) {
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('globals.confirmDeletion'),
|
||||
message: t('globals.confirmDeletionMessage'),
|
||||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
await axios.post(`dms/${dmsFk}/removeFile`);
|
||||
invoiceInRef.value.formData.dmsFk = null;
|
||||
invoiceInRef.value.formData.dms = undefined;
|
||||
invoiceInRef.value.hasChanges = true;
|
||||
invoiceInRef.value.save();
|
||||
});
|
||||
dms.value = {
|
||||
reference: invoiceIn.value.supplierRef,
|
||||
warehouseId: userConfig.value.warehouseFk,
|
||||
companyId: userConfig.value.companyFk,
|
||||
dmsTypeId: data.id,
|
||||
description: invoiceIn.value.supplier.name,
|
||||
hasFile: true,
|
||||
hasFileAttached: true,
|
||||
files: null,
|
||||
};
|
||||
|
||||
createDmsRef.value.show();
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
const isEdit = !!dms.value.id;
|
||||
const errors = {
|
||||
companyId: `The company can't be empty`,
|
||||
warehouseId: `The warehouse can't be empty`,
|
||||
dmsTypeId: `The DMS Type can't be empty`,
|
||||
description: `The description can't be empty`,
|
||||
};
|
||||
|
||||
Object.keys(errors).forEach((key) => {
|
||||
if (!dms.value[key]) throw Error(t(errors[key]));
|
||||
});
|
||||
|
||||
if (!isEdit && !dms.value.files) throw Error(t(`The files can't be empty`));
|
||||
|
||||
const formData = new FormData();
|
||||
|
||||
if (dms.value.files) {
|
||||
for (let i = 0; i < dms.value.files.length; i++)
|
||||
formData.append(dms.value.files[i].name, dms.value.files[i]);
|
||||
dms.value.hasFileAttached = true;
|
||||
}
|
||||
const url = isEdit ? `dms/${dms.value.id}/updateFile` : 'Dms/uploadFile';
|
||||
const { data } = await axios.post(url, formData, {
|
||||
params: dms.value,
|
||||
});
|
||||
|
||||
if (data.length) invoiceIn.value.dmsFk = data[0].id;
|
||||
|
||||
if (!isEdit) {
|
||||
createDmsRef.value.hide();
|
||||
} else {
|
||||
editDmsRef.value.hide();
|
||||
}
|
||||
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (error) {
|
||||
quasar.notify({
|
||||
message: t(`${error.message}`),
|
||||
type: 'negative',
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -181,10 +106,12 @@ async function onSubmit() {
|
|||
@on-fetch="(data) => (sageWithholdings = data)"
|
||||
/>
|
||||
<FormModel
|
||||
ref="invoiceInRef"
|
||||
model="InvoiceIn"
|
||||
:go-to="`/invoice-in/${invoiceId}/vat`"
|
||||
auto-load
|
||||
:url-update="`InvoiceIns/${invoiceId}/updateInvoiceIn`"
|
||||
@on-fetch="(data) => (documentDialogRef.supplierName = data.supplier.nickname)"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
@ -242,16 +169,22 @@ async function onSubmit() {
|
|||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
|
||||
<div class="row no-wrap">
|
||||
<VnInput
|
||||
:label="t('Document')"
|
||||
v-model="data.dmsFk"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
@update:model-value="checkFileExists(data.dmsFk)"
|
||||
>
|
||||
<template #prepend>
|
||||
<QBtn
|
||||
class="full-width"
|
||||
:disable="true"
|
||||
/>
|
||||
<div
|
||||
v-if="data.dmsFk"
|
||||
class="row no-wrap q-pa-xs q-gutter-x-xs"
|
||||
data-cy="dms-buttons"
|
||||
>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
|
@ -262,33 +195,52 @@ async function onSubmit() {
|
|||
round
|
||||
@click="downloadFile(data.dmsFk)"
|
||||
/>
|
||||
</template>
|
||||
<template #append>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
v-if="data.dmsFk"
|
||||
icon="edit"
|
||||
round
|
||||
padding="xs"
|
||||
@click="setEditDms(data.dmsFk)"
|
||||
@click="
|
||||
() => {
|
||||
documentDialogRef.show = true;
|
||||
documentDialogRef.dms = data.dms;
|
||||
}
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('Edit document') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
icon="delete"
|
||||
:title="t('Delete file')"
|
||||
padding="xs"
|
||||
round
|
||||
@click="deleteFile(data.dmsFk)"
|
||||
/>
|
||||
</div>
|
||||
<QBtn
|
||||
v-else
|
||||
icon="add_circle"
|
||||
round
|
||||
shortcut="+"
|
||||
padding="xs"
|
||||
@click="setCreateDms()"
|
||||
@click="
|
||||
() => {
|
||||
documentDialogRef.show = true;
|
||||
delete documentDialogRef.dms;
|
||||
}
|
||||
"
|
||||
data-cy="dms-create"
|
||||
>
|
||||
<QTooltip>{{ t('Create document') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnInput>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
|
@ -319,237 +271,28 @@ async function onSubmit() {
|
|||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
<QDialog ref="editDmsRef">
|
||||
<QForm @submit="onSubmit()" class="all-pointer-events">
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<span class="text-primary text-h6">
|
||||
<QIcon name="edit" class="q-mr-xs" />
|
||||
{{ t('Edit document') }}
|
||||
</span>
|
||||
<QSpace />
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
<QCardSection class="q-py-none">
|
||||
<QItem>
|
||||
<VnInput
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Reference')"
|
||||
v-model="dms.reference"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
<QDialog v-model="documentDialogRef.show">
|
||||
<VnDms
|
||||
model="dms"
|
||||
default-dms-code="invoiceIn"
|
||||
:form-initial-data="documentDialogRef.dms"
|
||||
:url="
|
||||
documentDialogRef.dms
|
||||
? `Dms/${documentDialogRef.dms.id}/updateFile`
|
||||
: 'Dms/uploadFile'
|
||||
"
|
||||
:description="documentDialogRef.supplierName"
|
||||
@on-data-saved="
|
||||
(_, { data }) => {
|
||||
let dmsData = data;
|
||||
if (Array.isArray(data)) dmsData = data[0];
|
||||
invoiceInRef.formData.dmsFk = dmsData.id;
|
||||
invoiceInRef.formData.dms = dmsData;
|
||||
invoiceInRef.hasChanges = true;
|
||||
invoiceInRef.save();
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnSelect
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Company')"
|
||||
v-model="dms.companyId"
|
||||
:options="companies"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:required="true"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelect
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Warehouse')"
|
||||
v-model="dms.warehouseId"
|
||||
:options="warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Type')"
|
||||
v-model="dms.dmsTypeId"
|
||||
:options="dmsTypes"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:required="true"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
v-model="dms.description"
|
||||
:required="true"
|
||||
type="textarea"
|
||||
class="full-width q-pa-xs"
|
||||
size="lg"
|
||||
autogrow
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QFile
|
||||
ref="inputFileRef"
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('File')"
|
||||
v-model="dms.files"
|
||||
multiple
|
||||
:accept="allowedContentTypes.join(',')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="attach_file_add"
|
||||
flat
|
||||
round
|
||||
padding="xs"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.selectFile') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn icon="info" flat round padding="xs">
|
||||
<QTooltip max-width="30rem">
|
||||
{{
|
||||
`${t(
|
||||
'Allowed content types'
|
||||
)}: ${allowedContentTypes.join(', ')}`
|
||||
}}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QFile>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QCheckbox
|
||||
:label="t('Generate identifier for original file')"
|
||||
v-model="dms.hasFile"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions class="justify-end">
|
||||
<QBtn
|
||||
flat
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn :label="t('globals.save')" color="primary" @click="onSubmit" />
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QForm>
|
||||
</QDialog>
|
||||
<QDialog ref="createDmsRef">
|
||||
<QForm @submit="onSubmit()" class="all-pointer-events">
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<span class="text-primary text-h6">
|
||||
<QIcon name="edit" class="q-mr-xs" />
|
||||
{{ t('Create document') }}
|
||||
</span>
|
||||
<QSpace />
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QItem>
|
||||
<VnInput
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Reference')"
|
||||
v-model="dms.reference"
|
||||
/>
|
||||
<VnSelect
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Company')}*`"
|
||||
v-model="dms.companyId"
|
||||
:options="companies"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:required="true"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelect
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Warehouse')}*`"
|
||||
v-model="dms.warehouseId"
|
||||
:options="warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Type')}*`"
|
||||
v-model="dms.dmsTypeId"
|
||||
:options="dmsTypes"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:required="true"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnInput
|
||||
class="full-width q-pa-xs"
|
||||
type="textarea"
|
||||
size="lg"
|
||||
autogrow
|
||||
:label="`${t('Description')}*`"
|
||||
v-model="dms.description"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
:rules="[(val) => val.length || t('Required field')]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QFile
|
||||
ref="inputFileRef"
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('File')"
|
||||
v-model="dms.files"
|
||||
multiple
|
||||
:accept="allowedContentTypes.join(',')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="attach_file_add"
|
||||
flat
|
||||
round
|
||||
padding="xs"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.selectFile') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn icon="info" flat round padding="xs">
|
||||
<QTooltip max-width="30rem">
|
||||
{{
|
||||
`${t(
|
||||
'Allowed content types'
|
||||
)}: ${allowedContentTypes.join(', ')}`
|
||||
}}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QFile>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QCheckbox
|
||||
:label="t('Generate identifier for original file')"
|
||||
v-model="dms.hasFile"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn
|
||||
flat
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn :label="t('globals.save')" color="primary" @click="onSubmit" />
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QForm>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -20,6 +20,23 @@ const filter = {
|
|||
{ relation: 'invoiceInDueDay' },
|
||||
{ relation: 'company' },
|
||||
{ relation: 'currency' },
|
||||
{
|
||||
relation: 'dms',
|
||||
scope: {
|
||||
fields: [
|
||||
'dmsTypeFk',
|
||||
'reference',
|
||||
'hardCopyNumber',
|
||||
'workerFk',
|
||||
'description',
|
||||
'hasFile',
|
||||
'file',
|
||||
'created',
|
||||
'companyFk',
|
||||
'warehouseFk',
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -109,7 +109,11 @@ const insertTag = (rows) => {
|
|||
>
|
||||
<template #body="{ rows, validate }">
|
||||
<QCard class="q-px-lg q-pt-md q-pb-sm">
|
||||
<VnRow v-for="(row, index) in rows" :key="index">
|
||||
<VnRow
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
class="items-center"
|
||||
>
|
||||
<VnSelect
|
||||
:label="t('itemTags.tag')"
|
||||
:options="tagOptions"
|
||||
|
@ -153,13 +157,14 @@ const insertTag = (rows) => {
|
|||
:required="true"
|
||||
:rules="validate('itemTag.priority')"
|
||||
/>
|
||||
<div class="row justify-center items-center" style="flex: 0">
|
||||
<div class="row justify-center" style="flex: 0">
|
||||
<QIcon
|
||||
@click="itemTagsRef.remove([row])"
|
||||
class="fill-icon-on-hover"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
dense
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('itemTags.removeTag') }}
|
||||
|
@ -167,22 +172,20 @@ const insertTag = (rows) => {
|
|||
</QIcon>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="justify-center items-center">
|
||||
</QCard>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
@click="insertTag(rows)"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
flat
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
style="flex: 0"
|
||||
fab
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('itemTags.addTag') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</QPage>
|
||||
|
|
|
@ -12,6 +12,8 @@ import ItemSummary from '../Item/Card/ItemSummary.vue';
|
|||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
||||
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import ItemListFilter from './ItemListFilter.vue';
|
||||
|
||||
const entityId = computed(() => route.params.id);
|
||||
const { openCloneDialog } = cloneItem();
|
||||
|
@ -311,6 +313,11 @@ const columns = computed(() => [
|
|||
:label="t('item.searchbar.label')"
|
||||
:info="t('You can search by id')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<ItemListFilter data-key="ItemList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="ItemList"
|
||||
|
@ -329,6 +336,7 @@ const columns = computed(() => [
|
|||
auto-load
|
||||
redirect="Item"
|
||||
:is-editable="false"
|
||||
:right-search="false"
|
||||
:filer="itemFilter"
|
||||
>
|
||||
<template #column-id="{ row }">
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
describe('InvoiceInBasicData', () => {
|
||||
const formInputs = '.q-form > .q-card input';
|
||||
const firstFormSelect = '.q-card > .vn-row:nth-child(1) > .q-select';
|
||||
const documentBtns = '.q-form .q-field button';
|
||||
const documentBtns = '[data-cy="dms-buttons"] button';
|
||||
const dialogInputs = '.q-dialog input';
|
||||
const dialogActionBtns = '.q-card__actions button';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
|
@ -21,27 +20,35 @@ describe('InvoiceInBasicData', () => {
|
|||
cy.get(formInputs).eq(1).invoke('val').should('eq', '4739');
|
||||
});
|
||||
|
||||
it('should edit the dms data', () => {
|
||||
it('should edit, remove and create the dms data', () => {
|
||||
const firtsInput = 'Ticket:65';
|
||||
const secondInput = "I don't know what posting here!";
|
||||
|
||||
//edit
|
||||
cy.get(documentBtns).eq(1).click();
|
||||
cy.get(dialogInputs).eq(0).type(`{selectall}${firtsInput}`);
|
||||
cy.get('textarea').type(`{selectall}${secondInput}`);
|
||||
cy.get(dialogActionBtns).eq(1).click();
|
||||
|
||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||
cy.get(documentBtns).eq(1).click();
|
||||
cy.get(dialogInputs).eq(0).invoke('val').should('eq', firtsInput);
|
||||
cy.get('textarea').invoke('val').should('eq', secondInput);
|
||||
});
|
||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
|
||||
it('should throw an error creating a new dms if a file is not attached', () => {
|
||||
cy.get(formInputs).eq(7).type('{selectall}{backspace}');
|
||||
cy.get(documentBtns).eq(0).click();
|
||||
cy.get(dialogActionBtns).eq(1).click();
|
||||
cy.get('.q-notification__message').should(
|
||||
'have.text',
|
||||
"The files can't be empty"
|
||||
//remove
|
||||
cy.get(documentBtns).eq(2).click();
|
||||
cy.get('[data-cy="VnConfirm_confirm"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
|
||||
//create
|
||||
cy.get('[data-cy="dms-create"]').eq(0).click();
|
||||
cy.get('[data-cy="VnDms_inputFile"').selectFile(
|
||||
'test/cypress/fixtures/image.jpg',
|
||||
{
|
||||
force: true,
|
||||
}
|
||||
);
|
||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,6 +14,8 @@ describe('Ticket descriptor', () => {
|
|||
|
||||
it('should clone the ticket without warehouse', () => {
|
||||
cy.visit('/#/ticket/1/summary');
|
||||
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
|
||||
cy.wait('@ticket');
|
||||
cy.openActionsDescriptor();
|
||||
cy.contains(listItem, toCloneOpt).click();
|
||||
cy.clickConfirm();
|
||||
|
@ -28,6 +30,8 @@ describe('Ticket descriptor', () => {
|
|||
|
||||
it('should set the weight of the ticket', () => {
|
||||
cy.visit('/#/ticket/10/summary');
|
||||
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
|
||||
cy.wait('@ticket');
|
||||
cy.openActionsDescriptor();
|
||||
cy.contains(listItem, setWeightOpt).click();
|
||||
cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');
|
||||
|
|
|
@ -261,7 +261,7 @@ Cypress.Commands.add('openActionDescriptor', (opt) => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add('openActionsDescriptor', () => {
|
||||
cy.get('.header > :nth-child(3) > .q-btn__content > .q-icon').click();
|
||||
cy.get('[data-cy="descriptor-more-opts"]').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openUserPanel', () => {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
import { describe, expect, it, beforeAll, beforeEach } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
describe('VnTable', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
|
||||
beforeAll(() => {
|
||||
wrapper = createWrapper(VnTable, {
|
||||
propsData: {
|
||||
columns: [],
|
||||
},
|
||||
});
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
|
||||
beforeEach(() => (vm.selected = []));
|
||||
|
||||
describe('handleSelection()', () => {
|
||||
const rows = [{ $index: 0 }, { $index: 1 }, { $index: 2 }];
|
||||
const selectedRows = [{ $index: 1 }];
|
||||
it('should add rows to selected when shift key is pressed and rows are added except last one', () => {
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
|
||||
rows
|
||||
);
|
||||
expect(vm.selected).toEqual([{ $index: 0 }]);
|
||||
});
|
||||
|
||||
it('should not add rows to selected when shift key is not pressed', () => {
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: false }, added: true, rows: selectedRows },
|
||||
rows
|
||||
);
|
||||
expect(vm.selected).toEqual([]);
|
||||
});
|
||||
|
||||
it('should not add rows to selected when rows are not added', () => {
|
||||
vm.handleSelection(
|
||||
{ evt: { shiftKey: true }, added: false, rows: selectedRows },
|
||||
rows
|
||||
);
|
||||
expect(vm.selected).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue