merge with dev
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
commit
89a3c399c1
|
@ -34,7 +34,6 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadFile = async function(ctx, id) {
|
Self.downloadFile = async function(ctx, id) {
|
||||||
const env = process.env.NODE_ENV;
|
|
||||||
const storageConnector = Self.app.dataSources.storage.connector;
|
const storageConnector = Self.app.dataSources.storage.connector;
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const dms = await Self.findById(id);
|
const dms = await Self.findById(id);
|
||||||
|
@ -43,23 +42,21 @@ module.exports = Self => {
|
||||||
if (!hasReadRole)
|
if (!hasReadRole)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
if (env && env != 'development') {
|
const pathHash = storageConnector.getPathHash(dms.id);
|
||||||
const pathHash = storageConnector.getPathHash(dms.id);
|
try {
|
||||||
file = {
|
await models.Container.getFile(pathHash, dms.file);
|
||||||
contentType: 'application/octet-stream',
|
} catch (e) {
|
||||||
container: pathHash,
|
if (e.code != 'ENOENT')
|
||||||
name: dms.file
|
throw e;
|
||||||
};
|
|
||||||
} else {
|
const error = new UserError(`File doesn't exists`);
|
||||||
file = {
|
error.statusCode = 404;
|
||||||
contentType: 'text/plain',
|
|
||||||
container: 'temp',
|
throw error;
|
||||||
name: `file.txt`
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const stream = await models.Container.downloadStream(file.container, file.name);
|
const stream = models.Container.downloadStream(pathHash, dms.file);
|
||||||
|
|
||||||
return [stream, file.contentType, `filename="${file.name}"`];
|
return [stream, dms.contentType, `filename="${dms.file}"`];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,10 @@ module.exports = Self => {
|
||||||
}, {
|
}, {
|
||||||
arg: 'hasFile',
|
arg: 'hasFile',
|
||||||
type: 'Boolean',
|
type: 'Boolean',
|
||||||
|
description: 'True if has original file'
|
||||||
|
}, {
|
||||||
|
arg: 'hasAttachedFile',
|
||||||
|
type: 'Boolean',
|
||||||
description: 'True if has an attached file'
|
description: 'True if has an attached file'
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -45,10 +49,8 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateFile = async(ctx, id, warehouseId, companyId,
|
Self.updateFile = async(ctx, id, warehouseId, companyId,
|
||||||
dmsTypeId, reference, description, hasFile, options) => {
|
dmsTypeId, reference, description, hasFile, hasAttachedFile, options) => {
|
||||||
const storageConnector = Self.app.dataSources.storage.connector;
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const fileOptions = {};
|
|
||||||
|
|
||||||
let tx;
|
let tx;
|
||||||
let myOptions = {};
|
let myOptions = {};
|
||||||
|
@ -66,73 +68,68 @@ module.exports = Self => {
|
||||||
if (!hasWriteRole)
|
if (!hasWriteRole)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
// Upload file to temporary path
|
const dms = await Self.findById(id, null, myOptions);
|
||||||
const tempContainer = await getContainer('temp');
|
await dms.updateAttributes({
|
||||||
let files = [];
|
dmsTypeFk: dmsTypeId,
|
||||||
try {
|
companyFk: companyId,
|
||||||
const uploaded = await models.Container.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);
|
warehouseFk: warehouseId,
|
||||||
files = Object.values(uploaded.files).map(file => {
|
reference: reference,
|
||||||
return file[0];
|
description: description,
|
||||||
});
|
hasFile: hasFile
|
||||||
} catch (err) {
|
}, myOptions);
|
||||||
if (err.message != 'No file content uploaded')
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedDmsList = [];
|
if (hasAttachedFile)
|
||||||
for (const file of files) {
|
updatedDms = await uploadNewFile(ctx, dms, myOptions);
|
||||||
const updatedDms = await updateDms(id, dmsTypeId, companyId, warehouseId,
|
|
||||||
reference, description, hasFile, file.name, myOptions);
|
|
||||||
|
|
||||||
const pathHash = storageConnector.getPathHash(updatedDms.id);
|
|
||||||
const container = await getContainer(pathHash);
|
|
||||||
|
|
||||||
const originPath = `${tempContainer.client.root}/${tempContainer.name}/${file.name}`;
|
|
||||||
const destinationPath = `${container.client.root}/${pathHash}/${updatedDms.file}`;
|
|
||||||
|
|
||||||
fs.rename(originPath, destinationPath);
|
|
||||||
|
|
||||||
updatedDmsList.push(updatedDms);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
return updatedDmsList;
|
return updatedDms;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function updateDms(id, dmsTypeId, companyId, warehouseId,
|
async function uploadNewFile(ctx, dms, myOptions) {
|
||||||
reference, description, hasFile, fileName, myOptions) {
|
|
||||||
const storageConnector = Self.app.dataSources.storage.connector;
|
const storageConnector = Self.app.dataSources.storage.connector;
|
||||||
const dms = await Self.findById(id, null, myOptions);
|
const models = Self.app.models;
|
||||||
const updatedDms = await dms.updateAttributes({
|
const fileOptions = {};
|
||||||
dmsTypeFk: dmsTypeId,
|
|
||||||
companyFk: companyId,
|
|
||||||
warehouseFk: warehouseId,
|
|
||||||
reference: reference,
|
|
||||||
description: description,
|
|
||||||
hasFile: hasFile
|
|
||||||
}, myOptions);
|
|
||||||
|
|
||||||
const oldExtension = storageConnector.getFileExtension(dms.file);
|
const tempContainer = await getContainer('temp');
|
||||||
const newExtension = storageConnector.getFileExtension(fileName);
|
const makeUpload = await models.Container.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);
|
||||||
|
const keys = Object.values(makeUpload.files);
|
||||||
|
const files = keys.map(file => file[0]);
|
||||||
|
const file = files[0];
|
||||||
|
|
||||||
try {
|
if (file) {
|
||||||
if (oldExtension != newExtension) {
|
const oldExtension = storageConnector.getFileExtension(dms.file);
|
||||||
const pathHash = storageConnector.getPathHash(updatedDms.id);
|
const newExtension = storageConnector.getFileExtension(file.name);
|
||||||
|
const fileName = `${dms.id}.${newExtension}`;
|
||||||
|
|
||||||
await Self.app.models.Container.removeFile(pathHash, dms.file);
|
try {
|
||||||
}
|
if (oldExtension != newExtension) {
|
||||||
} catch (err) {}
|
const pathHash = storageConnector.getPathHash(dms.id);
|
||||||
|
|
||||||
fileName = `${updatedDms.id}.${newExtension}`;
|
await models.Container.removeFile(pathHash, dms.file);
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
return updatedDms.updateAttribute('file', fileName, myOptions);
|
const updatedDms = await dms.updateAttributes({
|
||||||
|
contentType: file.type,
|
||||||
|
file: fileName
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const pathHash = storageConnector.getPathHash(updatedDms.id);
|
||||||
|
const container = await getContainer(pathHash);
|
||||||
|
|
||||||
|
const originPath = `${tempContainer.client.root}/${tempContainer.name}/${file.name}`;
|
||||||
|
const destinationPath = `${container.client.root}/${pathHash}/${updatedDms.file}`;
|
||||||
|
|
||||||
|
fs.rename(originPath, destinationPath);
|
||||||
|
|
||||||
|
return updatedDms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a container instance
|
* Returns a container instance
|
||||||
* If doesn't exists creates a new one
|
* If doesn't exists creates a new one
|
||||||
|
|
|
@ -70,7 +70,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const addedDms = [];
|
const addedDms = [];
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const newDms = await createDms(ctx, file.name, myOptions);
|
const newDms = await createDms(ctx, file, myOptions);
|
||||||
const pathHash = storageConnector.getPathHash(newDms.id);
|
const pathHash = storageConnector.getPathHash(newDms.id);
|
||||||
const container = await getContainer(pathHash);
|
const container = await getContainer(pathHash);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function createDms(ctx, fileName, myOptions) {
|
async function createDms(ctx, file, myOptions) {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const storageConnector = Self.app.dataSources.storage.connector;
|
const storageConnector = Self.app.dataSources.storage.connector;
|
||||||
const myUserId = ctx.req.accessToken.userId;
|
const myUserId = ctx.req.accessToken.userId;
|
||||||
|
@ -104,9 +104,11 @@ module.exports = Self => {
|
||||||
warehouseFk: args.warehouseId,
|
warehouseFk: args.warehouseId,
|
||||||
reference: args.reference,
|
reference: args.reference,
|
||||||
description: args.description,
|
description: args.description,
|
||||||
|
contentType: file.type,
|
||||||
hasFile: args.hasFile
|
hasFile: args.hasFile
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
let fileName = file.name;
|
||||||
const extension = storageConnector.getFileExtension(fileName);
|
const extension = storageConnector.getFileExtension(fileName);
|
||||||
fileName = `${newDms.id}.${extension}`;
|
fileName = `${newDms.id}.${extension}`;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
"file": {
|
"file": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"contentType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"reference": {
|
"reference": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -94,5 +94,6 @@
|
||||||
"Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
|
"Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
|
||||||
"This item is not available": "Este artículo no está disponible",
|
"This item is not available": "Este artículo no está disponible",
|
||||||
"This postcode already exists": "Este código postal ya existe",
|
"This postcode already exists": "Este código postal ya existe",
|
||||||
"Concept cannot be blank": "Concept cannot be blank"
|
"Concept cannot be blank": "El concepto no puede quedar en blanco",
|
||||||
|
"File doesn't exists": "El archivo no existe"
|
||||||
}
|
}
|
|
@ -42,7 +42,7 @@
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
field="$ctrl.address.postalCode"
|
field="$ctrl.address.postalCode"
|
||||||
on-change="$ctrl.setLocation()"
|
selection="$ctrl.postcodeSelection"
|
||||||
search-function="{code: $search}"
|
search-function="{code: $search}"
|
||||||
url="/api/Postcodes/location"
|
url="/api/Postcodes/location"
|
||||||
fields="['code', 'townFk']"
|
fields="['code', 'townFk']"
|
||||||
|
|
|
@ -46,12 +46,12 @@
|
||||||
label="File"
|
label="File"
|
||||||
model="$ctrl.dms.files"
|
model="$ctrl.dms.files"
|
||||||
on-change="$ctrl.onFileChange(files)"
|
on-change="$ctrl.onFileChange(files)"
|
||||||
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar">
|
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar, application/x-7z-compressed">
|
||||||
</vn-input-file>
|
</vn-input-file>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Attached file"
|
label="Generate identifier for original file"
|
||||||
field="$ctrl.dms.hasFile">
|
field="$ctrl.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -10,7 +10,8 @@ class Controller {
|
||||||
this.vnApp = vnApp;
|
this.vnApp = vnApp;
|
||||||
this.dms = {
|
this.dms = {
|
||||||
files: [],
|
files: [],
|
||||||
hasFile: false
|
hasFile: false,
|
||||||
|
hasAttachedFile: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,11 +79,13 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange(files) {
|
onFileChange(files) {
|
||||||
if (files.length > 0) {
|
let hasAttachedFile = false;
|
||||||
this.$.$applyAsync(() => {
|
if (files.length > 0)
|
||||||
this.dms.hasFile = true;
|
hasAttachedFile = true;
|
||||||
});
|
|
||||||
}
|
this.$.$applyAsync(() => {
|
||||||
|
this.dms.hasAttachedFile = hasAttachedFile;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ Upload file: Subir fichero
|
||||||
Upload: Subir
|
Upload: Subir
|
||||||
File: Fichero
|
File: Fichero
|
||||||
ClientFileDescription: "{{dmsTypeName}} del cliente {{clientName}} id {{clientId}}"
|
ClientFileDescription: "{{dmsTypeName}} del cliente {{clientName}} id {{clientId}}"
|
||||||
Attached file: Fichero adjunto
|
Generate identifier for original file: Generar identificador para archivo original
|
|
@ -45,12 +45,12 @@
|
||||||
label="File"
|
label="File"
|
||||||
model="$ctrl.dms.files"
|
model="$ctrl.dms.files"
|
||||||
on-change="$ctrl.onFileChange(files)"
|
on-change="$ctrl.onFileChange(files)"
|
||||||
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar">
|
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar, application/x-7z-compressed">
|
||||||
</vn-input-file>
|
</vn-input-file>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Attached file"
|
label="Generate identifier for original file"
|
||||||
field="$ctrl.dms.hasFile">
|
field="$ctrl.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Controller {
|
||||||
dmsTypeId: dms.dmsTypeFk,
|
dmsTypeId: dms.dmsTypeFk,
|
||||||
description: dms.description,
|
description: dms.description,
|
||||||
hasFile: dms.hasFile,
|
hasFile: dms.hasFile,
|
||||||
|
hasAttachedFile: false,
|
||||||
files: []
|
files: []
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -67,11 +68,13 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange(files) {
|
onFileChange(files) {
|
||||||
if (files.length > 0) {
|
let hasAttachedFile = false;
|
||||||
this.$.$applyAsync(() => {
|
if (files.length > 0)
|
||||||
this.dms.hasFile = true;
|
hasAttachedFile = true;
|
||||||
});
|
|
||||||
}
|
this.$.$applyAsync(() => {
|
||||||
|
this.dms.hasAttachedFile = hasAttachedFile;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Edit file: Editar fichero
|
Edit file: Editar fichero
|
||||||
File: Fichero
|
File: Fichero
|
||||||
Attached file: Fichero adjunto
|
Generate identifier for original file: Generar identificador para archivo original
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
|
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
|
||||||
<vn-th field="reference">Reference</vn-th>
|
<vn-th field="reference">Reference</vn-th>
|
||||||
<vn-th>Description</vn-th>
|
<vn-th>Description</vn-th>
|
||||||
<vn-th field="hasFile" center>Original</vn-th>
|
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||||
<vn-th shrink>File</vn-th>
|
<vn-th>File</vn-th>
|
||||||
<vn-th shrink>Employee</vn-th>
|
<vn-th shrink>Employee</vn-th>
|
||||||
<vn-th field="created">Created</vn-th>
|
<vn-th field="created">Created</vn-th>
|
||||||
<vn-th number></vn-th>
|
<vn-th number></vn-th>
|
||||||
|
@ -41,12 +41,17 @@
|
||||||
{{::document.dms.description}}
|
{{::document.dms.description}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink center>
|
<vn-td shrink>
|
||||||
<vn-check disabled="true"
|
<vn-check disabled="true"
|
||||||
field="document.dms.hasFile">
|
field="document.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>{{::document.dms.file}}</vn-td>
|
<vn-td>
|
||||||
|
<a target="_blank"
|
||||||
|
vn-tooltip="Download file"
|
||||||
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">{{::document.dms.file}}
|
||||||
|
</a>
|
||||||
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, document.dms.workerFk)">
|
ng-click="$ctrl.showWorkerDescriptor($event, document.dms.workerFk)">
|
||||||
|
|
|
@ -45,12 +45,12 @@
|
||||||
label="File"
|
label="File"
|
||||||
model="$ctrl.dms.files"
|
model="$ctrl.dms.files"
|
||||||
on-change="$ctrl.onFileChange(files)"
|
on-change="$ctrl.onFileChange(files)"
|
||||||
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar">
|
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar, application/x-7z-compressed">
|
||||||
</vn-input-file>
|
</vn-input-file>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Attached file"
|
label="Generate identifier for original file"
|
||||||
field="$ctrl.dms.hasFile">
|
field="$ctrl.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -10,7 +10,8 @@ class Controller {
|
||||||
this.vnApp = vnApp;
|
this.vnApp = vnApp;
|
||||||
this.dms = {
|
this.dms = {
|
||||||
files: [],
|
files: [],
|
||||||
hasFile: false
|
hasFile: false,
|
||||||
|
hasAttachedFile: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,11 +77,13 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange(files) {
|
onFileChange(files) {
|
||||||
if (files.length > 0) {
|
let hasAttachedFile = false;
|
||||||
this.$.$applyAsync(() => {
|
if (files.length > 0)
|
||||||
this.dms.hasFile = true;
|
hasAttachedFile = true;
|
||||||
});
|
|
||||||
}
|
this.$.$applyAsync(() => {
|
||||||
|
this.dms.hasAttachedFile = hasAttachedFile;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ Upload file: Subir fichero
|
||||||
Upload: Subir
|
Upload: Subir
|
||||||
File: Fichero
|
File: Fichero
|
||||||
FileDescription: Ticket id {{ticketId}} del cliente {{clientName}} id {{clientId}}
|
FileDescription: Ticket id {{ticketId}} del cliente {{clientName}} id {{clientId}}
|
||||||
Attached file: Fichero adjunto
|
Generate identifier for original file: Generar identificador para archivo original
|
|
@ -45,12 +45,12 @@
|
||||||
label="File"
|
label="File"
|
||||||
model="$ctrl.dms.files"
|
model="$ctrl.dms.files"
|
||||||
on-change="$ctrl.onFileChange(files)"
|
on-change="$ctrl.onFileChange(files)"
|
||||||
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar">
|
accept=".pdf, .png, .jpg, .jpeg, application/zip, application/rar, application/x-7z-compressed">
|
||||||
</vn-input-file>
|
</vn-input-file>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Attached file"
|
label="Generate identifier for original file"
|
||||||
field="$ctrl.dms.hasFile">
|
field="$ctrl.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Controller {
|
||||||
dmsTypeId: dms.dmsTypeFk,
|
dmsTypeId: dms.dmsTypeFk,
|
||||||
description: dms.description,
|
description: dms.description,
|
||||||
hasFile: dms.hasFile,
|
hasFile: dms.hasFile,
|
||||||
|
hasAttachedFile: false,
|
||||||
files: []
|
files: []
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -67,11 +68,13 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange(files) {
|
onFileChange(files) {
|
||||||
if (files.length > 0) {
|
let hasAttachedFile = false;
|
||||||
this.$.$applyAsync(() => {
|
if (files.length > 0)
|
||||||
this.dms.hasFile = true;
|
hasAttachedFile = true;
|
||||||
});
|
|
||||||
}
|
this.$.$applyAsync(() => {
|
||||||
|
this.dms.hasAttachedFile = hasAttachedFile;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Edit file: Editar fichero
|
Edit file: Editar fichero
|
||||||
File: Fichero
|
File: Fichero
|
||||||
Attached file: Fichero adjunto
|
Generate identifier for original file: Generar identificador para archivo original
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
|
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
|
||||||
<vn-th field="reference">Reference</vn-th>
|
<vn-th field="reference">Reference</vn-th>
|
||||||
<vn-th>Description</vn-th>
|
<vn-th>Description</vn-th>
|
||||||
<vn-th field="hasFile" center>Attached file</vn-th>
|
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||||
<vn-th shrink>File</vn-th>
|
<vn-th>File</vn-th>
|
||||||
<vn-th>Employee</vn-th>
|
<vn-th shrink>Employee</vn-th>
|
||||||
<vn-th field="created">Created</vn-th>
|
<vn-th field="created">Created</vn-th>
|
||||||
<vn-th></vn-th>
|
<vn-th number></vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
|
@ -41,13 +41,19 @@
|
||||||
{{::document.dms.description}}
|
{{::document.dms.description}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td center>
|
<vn-td shrink>
|
||||||
<vn-check disabled="true"
|
<vn-check disabled="true"
|
||||||
field="document.dms.hasFile">
|
field="document.dms.hasFile">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>{{::document.dms.file}}</vn-td>
|
|
||||||
<vn-td>
|
<vn-td>
|
||||||
|
<a target="_blank"
|
||||||
|
vn-tooltip="Download file"
|
||||||
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
|
{{::document.dms.file}}
|
||||||
|
</a>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td shrink>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, document.dms.workerFk)">
|
ng-click="$ctrl.showWorkerDescriptor($event, document.dms.workerFk)">
|
||||||
{{::document.dms.worker.user.nickname | dashIfEmpty}}
|
{{::document.dms.worker.user.nickname | dashIfEmpty}}
|
||||||
|
@ -55,7 +61,7 @@
|
||||||
<vn-td>
|
<vn-td>
|
||||||
{{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
|
{{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td center shrink>
|
<vn-td number>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
vn-tooltip="Download file"
|
vn-tooltip="Download file"
|
||||||
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
|
|
Loading…
Reference in New Issue