diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f493764a..c97c4181f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [2418.01]
+
## [2416.01] - 2024-04-18
### Added
diff --git a/package.json b/package.json
index 82f21efe6..88f430d7b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-front",
- "version": "24.16.0",
+ "version": "24.18.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue
index 2d8886610..718d087fe 100644
--- a/src/components/FormModelPopup.vue
+++ b/src/components/FormModelPopup.vue
@@ -78,6 +78,7 @@ defineExpose({
diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue
index 23e00f5d9..f70146c58 100644
--- a/src/components/common/VnDmsList.vue
+++ b/src/components/common/VnDmsList.vue
@@ -5,9 +5,11 @@ import { useRoute } from 'vue-router';
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
import axios from 'axios';
-import FetchData from 'components/FetchData.vue';
+import VnPaginate from 'components/ui/VnPaginate.vue';
import VnDms from 'src/components/common/VnDms.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
+import VnInputDate from 'components/common/VnInputDate.vue';
+import VnUserLink from '../ui/VnUserLink.vue';
import { downloadFile } from 'src/composables/downloadFile';
const route = useRoute();
@@ -26,6 +28,15 @@ const $props = defineProps({
type: String,
default: null,
},
+ deleteModel: {
+ type: String,
+ default: null,
+ },
+ downloadModel: {
+ type: String,
+ required: false,
+ default: null,
+ },
defaultDmsCode: {
type: String,
required: true,
@@ -74,7 +85,7 @@ const dmsFilter = {
],
},
},
- order: ['dmsFk DESC'],
+ where: { [$props.filter]: route.params.id },
};
const columns = computed(() => [
@@ -94,12 +105,12 @@ const columns = computed(() => [
props: (prop) => ({
readonly: true,
borderless: true,
- 'model-value': prop.row.dmsType.name,
+ 'model-value': prop.row.dmsType?.name,
}),
},
{
align: 'left',
- field: 'order',
+ field: 'hardCopyNumber',
label: t('globals.order'),
name: 'order',
component: 'span',
@@ -117,6 +128,7 @@ const columns = computed(() => [
label: t('globals.description'),
name: 'description',
component: 'span',
+ props: (prop) => ({ value: prop.value?.toUpperCase() }),
},
{
align: 'left',
@@ -136,21 +148,53 @@ const columns = computed(() => [
name: 'file',
component: 'span',
},
+ {
+ align: 'left',
+ field: 'worker',
+ label: t('globals.worker'),
+ name: 'worker',
+ component: VnUserLink,
+ props: (prop) => ({
+ name: prop.row.worker?.user?.name.toLowerCase(),
+ workerId: prop.row.worker?.id,
+ }),
+ },
+ {
+ align: 'left',
+ field: 'created',
+ label: t('globals.created'),
+ name: 'created',
+ component: VnInputDate,
+ props: (prop) => ({
+ disable: true,
+ 'model-value': prop.row.created,
+ }),
+ },
{
field: 'options',
name: 'options',
components: [
{
component: QBtn,
+ name: 'download',
+ isDocuware: true,
props: () => ({
icon: 'cloud_download',
flat: true,
color: 'primary',
}),
- click: (prop) => downloadFile(prop.row.id),
+ click: (prop) =>
+ downloadFile(
+ prop.row.id,
+ $props.downloadModel,
+ null,
+ prop.row.download
+ ),
},
{
component: QBtn,
+ name: 'edit',
+ external: false,
props: () => ({
icon: 'edit',
flat: true,
@@ -160,6 +204,8 @@ const columns = computed(() => [
},
{
component: QBtn,
+ name: 'delete',
+ external: false,
props: () => ({
icon: 'delete',
flat: true,
@@ -167,12 +213,24 @@ const columns = computed(() => [
}),
click: (prop) => deleteDms(prop.row.id),
},
+ {
+ component: QBtn,
+ name: 'open',
+ external: true,
+ props: () => ({
+ icon: 'open_in_new',
+ flat: true,
+ color: 'primary',
+ }),
+ click: (prop) => open(prop.row.url),
+ },
],
},
]);
function setData(data) {
- const newData = data.map((value) => value.dms);
+ const newData = data.map((value) => value.dms || value);
+ newData.sort((a, b) => new Date(b.created) - new Date(a.created));
rows.value = newData;
}
@@ -186,7 +244,7 @@ function deleteDms(dmsFk) {
},
})
.onOk(async () => {
- await axios.post(`${$props.model}/${dmsFk}/removeFile`);
+ await axios.post(`${$props.deleteModel ?? $props.model}/${dmsFk}/removeFile`);
const index = rows.value.findIndex((row) => row.id == dmsFk);
rows.value.splice(index, 1);
});
@@ -206,84 +264,106 @@ function parseDms(data) {
}
return data;
}
+
+async function open(url) {
+ window.open(url).focus();
+}
+
+function shouldRenderButton(button, isExternal = false) {
+ if (button.name == 'download') return true;
+ return button.external === isExternal;
+}
-
-
-
-
-
-
- {{ props.value }}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ col.label }}:
- {{ col.value }}
-
-
-
+
+
+
+
+
+ {{ props.value }}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ col.label }}:
+ {{ col.value }}
+
+
+
+
+
+
+
+
-
+
{
@@ -91,6 +91,10 @@ watch(
}
);
+const addFilter = async (filter, params) => {
+ await arrayData.addFilter({ filter, params });
+};
+
async function fetch() {
await arrayData.fetch({ append: false });
if (!arrayData.hasMoreData.value) {
@@ -106,11 +110,10 @@ async function paginate() {
isLoading.value = true;
await arrayData.loadMore();
-
if (!arrayData.hasMoreData.value) {
if (store.userParamsChanged) arrayData.hasMoreData.value = true;
store.userParamsChanged = false;
- isLoading.value = false;
+ endPagination();
return;
}
@@ -120,12 +123,15 @@ async function paginate() {
pagination.value.sortBy = sortBy;
pagination.value.descending = descending;
- isLoading.value = false;
+ endPagination();
+}
+function endPagination() {
+ hasMoreData.value = arrayData.hasMoreData.value;
+ isLoading.value = false;
emit('onFetch', store.data);
emit('onPaginate');
}
-
async function onLoad(index, done) {
if (!store.data) {
return done();
@@ -140,6 +146,8 @@ async function onLoad(index, done) {
if (store.userParamsChanged) isDone = !arrayData.hasMoreData.value;
done(isDone);
}
+
+defineExpose({ fetch, addFilter });
@@ -188,6 +196,9 @@ async function onLoad(index, done) {
+
+
+