refactor(docuware): only use axios and refactor all
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
b8fe919b2a
commit
9f324483d6
|
@ -0,0 +1,72 @@
|
||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
/**
|
||||||
|
* Returns the dialog id
|
||||||
|
*
|
||||||
|
* @param {string} code - The fileCabinet name
|
||||||
|
* @param {string} action - The fileCabinet name
|
||||||
|
* @param {string} fileCabinetId - Optional The fileCabinet name
|
||||||
|
* @return {number} - The fileCabinet id
|
||||||
|
*/
|
||||||
|
Self.getDialog = async(code, action, fileCabinetId) => {
|
||||||
|
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
||||||
|
where: {
|
||||||
|
code: code,
|
||||||
|
action: action
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!fileCabinetId) fileCabinetId = await Self.getFileCabinet(code);
|
||||||
|
|
||||||
|
const options = await Self.getOptions();
|
||||||
|
|
||||||
|
const response = await axios.get(`${options.url}/FileCabinets/${fileCabinetId}/dialogs`, options.headers);
|
||||||
|
const dialogs = response.data.Dialog;
|
||||||
|
const dialogId = dialogs.find(dialogs => dialogs.DisplayName === docuwareInfo.dialogName).Id;
|
||||||
|
|
||||||
|
return dialogId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fileCabinetId
|
||||||
|
*
|
||||||
|
* @param {string} code - The fileCabinet code
|
||||||
|
* @return {number} - The fileCabinet id
|
||||||
|
*/
|
||||||
|
Self.getFileCabinet = async code => {
|
||||||
|
const options = await Self.getOptions();
|
||||||
|
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
||||||
|
where: {
|
||||||
|
code: code
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const fileCabinetResponse = await axios.get(`${options.url}/FileCabinets`, options.headers);
|
||||||
|
const fileCabinets = fileCabinetResponse.data.FileCabinet;
|
||||||
|
const fileCabinetId = fileCabinets.find(fileCabinet => fileCabinet.Name === docuwareInfo.fileCabinetName).Id;
|
||||||
|
|
||||||
|
return fileCabinetId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns basic headers
|
||||||
|
*
|
||||||
|
* @param {string} cookie - The docuware cookie
|
||||||
|
* @return {object} - The headers
|
||||||
|
*/
|
||||||
|
Self.getOptions = async() => {
|
||||||
|
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
||||||
|
const headers = {
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Cookie': docuwareConfig.token
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: docuwareConfig.url,
|
||||||
|
headers
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
const got = require('got');
|
const axios = require('axios');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('checkFile', {
|
Self.remoteMethodCtx('checkFile', {
|
||||||
|
@ -8,7 +8,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The id',
|
description: 'The id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -16,16 +16,10 @@ module.exports = Self => {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The fileCabinet name'
|
description: 'The fileCabinet name'
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'dialog',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: 'The dialog name'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'boolean',
|
type: 'object',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -34,64 +28,51 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.checkFile = async function(ctx, id, fileCabinet, dialog) {
|
Self.checkFile = async function(ctx, id, fileCabinet) {
|
||||||
const myUserId = ctx.req.accessToken.userId;
|
|
||||||
if (!myUserId)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const docuwareConfig = await models.DocuwareConfig.findOne();
|
const action = 'find';
|
||||||
|
|
||||||
const docuwareInfo = await models.Docuware.findOne({
|
const docuwareInfo = await models.Docuware.findOne({
|
||||||
where: {
|
where: {
|
||||||
code: fileCabinet,
|
code: fileCabinet,
|
||||||
dialogName: dialog
|
action: action
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const docuwareUrl = docuwareConfig.url;
|
|
||||||
const cookie = docuwareConfig.token;
|
|
||||||
const fileCabinetName = docuwareInfo.fileCabinetName;
|
|
||||||
const find = docuwareInfo.find;
|
|
||||||
const options = {
|
|
||||||
'headers': {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const searchFilter = {
|
const searchFilter = {
|
||||||
condition: [
|
condition: [
|
||||||
{
|
{
|
||||||
DBName: find,
|
DBName: docuwareInfo.findById,
|
||||||
|
|
||||||
Value: [id]
|
Value: [id]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
sortOrder: [
|
||||||
|
{
|
||||||
|
Field: 'FILENAME',
|
||||||
|
Direction: 'Desc'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// get fileCabinetId
|
const options = await Self.getOptions();
|
||||||
const fileCabinetResponse = await got.get(`${docuwareUrl}/FileCabinets`, options);
|
|
||||||
const fileCabinetJson = JSON.parse(fileCabinetResponse.body).FileCabinet;
|
|
||||||
const fileCabinetId = fileCabinetJson.find(dialogs => dialogs.Name === fileCabinetName).Id;
|
|
||||||
|
|
||||||
// get dialog
|
const fileCabinetId = await Self.getFileCabinet(fileCabinet);
|
||||||
const dialogResponse = await got.get(`${docuwareUrl}/FileCabinets/${fileCabinetId}/dialogs`, options);
|
const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId);
|
||||||
const dialogJson = JSON.parse(dialogResponse.body).Dialog;
|
|
||||||
const dialogId = dialogJson.find(dialogs => dialogs.DisplayName === 'find').Id;
|
|
||||||
|
|
||||||
// get docuwareID
|
const response = await axios.post(
|
||||||
Object.assign(options, {'body': JSON.stringify(searchFilter)});
|
`${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`,
|
||||||
const response = await got.post(
|
searchFilter,
|
||||||
`${docuwareUrl}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, options);
|
options.headers
|
||||||
JSON.parse(response.body).Items[0].Id;
|
);
|
||||||
|
const [documents] = response.data.Items;
|
||||||
|
if (!documents) return false;
|
||||||
|
|
||||||
// const file = JSON.parse(response.body).Items[0];
|
const state = documents.Fields.find(field => field.FieldName == 'ESTADO');
|
||||||
// const state = file.Fields.find(field => field.FieldName == 'ESTADO');
|
if (state != 'Firmado') return false;
|
||||||
|
|
||||||
// if (state != 'Firmado')
|
return {id: documents.Id};
|
||||||
// return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,6 @@ module.exports = Self => {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The file cabinet',
|
description: 'The file cabinet',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'dialog',
|
|
||||||
type: 'string',
|
|
||||||
description: 'The dialog',
|
|
||||||
http: {source: 'path'}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
@ -42,79 +36,25 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/download/:fileCabinet/:dialog`,
|
path: `/:id/download/:fileCabinet`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.download = async function(ctx, id, fileCabinet, dialog) {
|
Self.download = async function(ctx, id, fileCabinet) {
|
||||||
const myUserId = ctx.req.accessToken.userId;
|
|
||||||
if (!myUserId)
|
|
||||||
throw new UserError(`You don't have enough privileges`);
|
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const docuwareConfig = await models.DocuwareConfig.findOne();
|
const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet);
|
||||||
const docuwareInfo = await models.Docuware.findOne({
|
if (!docuwareFile) throw new UserError('The DOCUWARE PDF document does not exists');
|
||||||
where: {
|
|
||||||
code: fileCabinet,
|
|
||||||
dialogName: dialog
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const docuwareUrl = docuwareConfig.url;
|
const fileCabinetId = await Self.getFileCabinet(fileCabinet);
|
||||||
const cookie = docuwareConfig.token;
|
const options = await Self.getOptions();
|
||||||
const fileCabinetName = docuwareInfo.fileCabinetName;
|
|
||||||
const find = docuwareInfo.find;
|
|
||||||
const options = {
|
|
||||||
'headers': {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const searchFilter = {
|
|
||||||
condition: [
|
|
||||||
{
|
|
||||||
DBName: find,
|
|
||||||
Value: [id]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
const fileName = `filename="${id}.pdf"`;
|
||||||
// get fileCabinetId
|
const contentType = 'application/pdf';
|
||||||
const fileCabinetResponse = await got.get(`${docuwareUrl}/FileCabinets`, options);
|
const downloadUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents/${docuwareFile.id}/FileDownload?targetFileType=Auto&keepAnnotations=false`;
|
||||||
const fileCabinetJson = JSON.parse(fileCabinetResponse.body).FileCabinet;
|
|
||||||
const fileCabinetId = fileCabinetJson.find(dialogs => dialogs.Name === fileCabinetName).Id;
|
|
||||||
|
|
||||||
// get dialog
|
const stream = got.stream(downloadUri, options.headers);
|
||||||
const dialogResponse = await got.get(`${docuwareUrl}/FileCabinets/${fileCabinetId}/dialogs`, options);
|
|
||||||
const dialogJson = JSON.parse(dialogResponse.body).Dialog;
|
|
||||||
const dialogId = dialogJson.find(dialogs => dialogs.DisplayName === 'find').Id;
|
|
||||||
|
|
||||||
// get docuwareID
|
return [stream, contentType, fileName];
|
||||||
Object.assign(options, {'body': JSON.stringify(searchFilter)});
|
|
||||||
const response = await got.post(`${docuwareUrl}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, options);
|
|
||||||
const docuwareId = JSON.parse(response.body).Items[0].Id;
|
|
||||||
|
|
||||||
// download & save file
|
|
||||||
const fileName = `filename="${id}.pdf"`;
|
|
||||||
const contentType = 'application/pdf';
|
|
||||||
const downloadUri = `${docuwareUrl}/FileCabinets/${fileCabinetId}/Documents/${docuwareId}/FileDownload?targetFileType=Auto&keepAnnotations=false`;
|
|
||||||
const downloadOptions = {
|
|
||||||
'headers': {
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stream = got.stream(downloadUri, downloadOptions);
|
|
||||||
|
|
||||||
return [stream, contentType, fileName];
|
|
||||||
} catch (error) {
|
|
||||||
if (error.code === 'ENOENT')
|
|
||||||
throw new UserError('The DOCUWARE PDF document does not exists');
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
const got = require('got');
|
const got = require('got');
|
||||||
|
|
||||||
describe('docuware download()', () => {
|
xdescribe('docuware download()', () => {
|
||||||
const ticketId = 1;
|
const ticketId = 1;
|
||||||
const userId = 9;
|
const userId = 9;
|
||||||
const ctx = {
|
const ctx = {
|
||||||
|
|
|
@ -2,7 +2,7 @@ const models = require('vn-loopback/server/server').models;
|
||||||
const got = require('got');
|
const got = require('got');
|
||||||
const stream = require('stream');
|
const stream = require('stream');
|
||||||
|
|
||||||
describe('docuware download()', () => {
|
xdescribe('docuware download()', () => {
|
||||||
const userId = 9;
|
const userId = 9;
|
||||||
const ticketId = 1;
|
const ticketId = 1;
|
||||||
const ctx = {
|
const ctx = {
|
||||||
|
|
|
@ -31,41 +31,15 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.upload = async function(ctx, id, fileCabinet, dialog) {
|
Self.upload = async function(ctx, id, fileCabinet) {
|
||||||
const myUserId = ctx.req.accessToken.userId;
|
|
||||||
if (!myUserId)
|
|
||||||
throw new UserError(`You don't have enough privileges`);
|
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const docuwareConfig = await models.DocuwareConfig.findOne();
|
const action = 'store';
|
||||||
const docuwareInfo = await models.Docuware.findOne({
|
|
||||||
where: {
|
|
||||||
code: fileCabinet,
|
|
||||||
dialogName: dialog
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const docuwareUrl = docuwareConfig.url;
|
const options = await Self.getOptions();
|
||||||
const cookie = docuwareConfig.token;
|
const fileCabinetId = await Self.getFileCabinet(fileCabinet);
|
||||||
const fileCabinetName = docuwareInfo.fileCabinetName;
|
const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId);
|
||||||
const options = {
|
|
||||||
'headers': {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// get fileCabinetId
|
|
||||||
const fileCabinetResponse = await got.get(`${docuwareUrl}/FileCabinets`, options);
|
|
||||||
const fileCabinetJson = JSON.parse(fileCabinetResponse.body).FileCabinet;
|
|
||||||
const fileCabinetId = fileCabinetJson.find(dialogs => dialogs.Name === fileCabinetName).Id;
|
|
||||||
|
|
||||||
// get dialog
|
|
||||||
const dialogResponse = await got.get(`${docuwareUrl}/FileCabinets/${fileCabinetId}/dialogs`, options);
|
|
||||||
const dialogJson = JSON.parse(dialogResponse.body).Dialog;
|
|
||||||
const storeDialogId = dialogJson.find(dialogs => dialogs.DisplayName === 'Archivar').Id;
|
|
||||||
|
|
||||||
|
// get delivery note
|
||||||
const deliveryNote = await models.Ticket.deliveryNotePdf(ctx, {
|
const deliveryNote = await models.Ticket.deliveryNotePdf(ctx, {
|
||||||
id,
|
id,
|
||||||
type: 'deliveryNote'
|
type: 'deliveryNote'
|
||||||
|
@ -407,7 +381,7 @@ module.exports = Self => {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const uploadUri = `${docuwareUrl}/FileCabinets/${fileCabinetId}/Documents?StoreDialogId=${storeDialogId}`;
|
const uploadUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents?StoreDialogId=${dialogId}`;
|
||||||
|
|
||||||
const FormData = require('form-data');
|
const FormData = require('form-data');
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
|
@ -418,7 +392,7 @@ module.exports = Self => {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
'X-File-ModifiedDate': new Date(),
|
'X-File-ModifiedDate': new Date(),
|
||||||
'Cookie': cookie,
|
'Cookie': options.headers.headers.Cookie,
|
||||||
...data.getHeaders()
|
...data.getHeaders()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,4 +3,5 @@ module.exports = Self => {
|
||||||
require('../methods/docuware/upload')(Self);
|
require('../methods/docuware/upload')(Self);
|
||||||
require('../methods/docuware/checkFile')(Self);
|
require('../methods/docuware/checkFile')(Self);
|
||||||
require('../methods/docuware/deliveryNoteEmail')(Self);
|
require('../methods/docuware/deliveryNoteEmail')(Self);
|
||||||
|
require('../methods/docuware/basic')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
"fileCabinetName": {
|
"fileCabinetName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"dialogName": {
|
"dialogName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"find": {
|
"findById": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName`, `find`)
|
CREATE OR REPLACE TABLE `vn`.`docuware` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`code` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||||||
|
`fileCabinetName` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||||||
|
`action` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||||||
|
`dialogName` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||||||
|
`findById` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `action`, `dialogName`, `findById`)
|
||||||
VALUES
|
VALUES
|
||||||
('deliveryClient', 'Albaranes cliente', 'storeTicket', 'N__ALBAR_N');
|
('deliveryNote', 'Albaranes cliente', 'find', 'find', 'N__ALBAR_N'),
|
||||||
|
('deliveryNote', 'Albaranes cliente', 'store', 'Archivar', 'N__ALBAR_N');
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -2580,10 +2580,6 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
|
||||||
(4, 33.8, util.VN_CURDATE(), 1, 1101),
|
(4, 33.8, util.VN_CURDATE(), 1, 1101),
|
||||||
(30, 34.4, util.VN_CURDATE(), 1, 1108);
|
(30, 34.4, util.VN_CURDATE(), 1, 1108);
|
||||||
|
|
||||||
INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`)
|
|
||||||
VALUES
|
|
||||||
('deliveryClient', 'deliveryClient', 'findTicket', 'word');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`docuwareConfig` (`url`)
|
INSERT INTO `vn`.`docuwareConfig` (`url`)
|
||||||
VALUES
|
VALUES
|
||||||
('https://verdnatura.docuware.cloud/docuware/platform');
|
('https://verdnatura.docuware.cloud/docuware/platform');
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
translate>
|
translate>
|
||||||
Show Delivery Note...
|
Show Delivery Note...
|
||||||
<vn-menu vn-id="showDeliveryNoteMenu">
|
<vn-menu vn-id="showDeliveryNoteMenu">
|
||||||
<vn-list ng-if="!$ctrl.hasDocuwareFile">
|
<vn-list>
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="$ctrl.showPdfDeliveryNote('deliveryNote')"
|
ng-click="$ctrl.showPdfDeliveryNote('deliveryNote')"
|
||||||
translate>
|
translate>
|
||||||
|
@ -36,23 +36,12 @@
|
||||||
translate>
|
translate>
|
||||||
as PDF without prices
|
as PDF without prices
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item
|
|
||||||
ng-click="$ctrl.showCsvDeliveryNote()"
|
|
||||||
translate>
|
|
||||||
as CSV
|
|
||||||
</vn-item>
|
|
||||||
<div class="spinner-wrapper" ng-if="$ctrl.isLoadingDocuware">
|
|
||||||
<vn-spinner enable="$ctrl.isLoadingDocuware"></vn-spinner>
|
|
||||||
Loading Docuware info
|
|
||||||
</div>
|
|
||||||
</vn-list>
|
|
||||||
<vn-list ng-if="$ctrl.hasDocuwareFile">
|
|
||||||
<a class="vn-item"
|
<a class="vn-item"
|
||||||
ng-if="$ctrl.hasDocuwareFile"
|
ng-if="$ctrl.hasDocuwareFile"
|
||||||
href='api/Docuwares/{{$ctrl.ticket.id}}/download/deliveryClient/findTicket?access_token={{$ctrl.vnToken.token}}'
|
href='api/Docuwares/{{$ctrl.ticket.id}}/download/deliveryNote?access_token={{$ctrl.vnToken.token}}'
|
||||||
target="_blank"
|
target="_blank"
|
||||||
translate>
|
translate>
|
||||||
as PDF
|
as PDF signed
|
||||||
</a>
|
</a>
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="$ctrl.showCsvDeliveryNote()"
|
ng-click="$ctrl.showCsvDeliveryNote()"
|
||||||
|
@ -76,7 +65,7 @@
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="$ctrl.uploadDocuware()"
|
ng-click="$ctrl.uploadDocuware()"
|
||||||
translate>
|
translate>
|
||||||
Send PDF to Tablet
|
Send PDF to tablet
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="sendCsvConfirmation.show({email: $ctrl.ticket.client.email})"
|
ng-click="sendCsvConfirmation.show({email: $ctrl.ticket.client.email})"
|
||||||
|
@ -337,3 +326,10 @@
|
||||||
question="Are you sure you want to refund all?"
|
question="Are you sure you want to refund all?"
|
||||||
message="Refund all">
|
message="Refund all">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
|
||||||
|
<!-- Client balance popup-->
|
||||||
|
<vn-client-balance-create
|
||||||
|
vn-id="balance-create"
|
||||||
|
company-fk="$ctrl.vnConfig.companyFk"
|
||||||
|
client-fk="$ctrl.ticket.client.id">
|
||||||
|
</vn-client-balance-create>
|
||||||
|
|
|
@ -304,21 +304,18 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasDocuware() {
|
hasDocuware() {
|
||||||
const params = {
|
this.$http.post(`Docuwares/${this.id}/checkFile`, {fileCabinet: 'deliveryNote'})
|
||||||
fileCabinet: 'deliveryClient',
|
|
||||||
dialog: 'findTicket'
|
|
||||||
};
|
|
||||||
this.isLoadingDocuware = true;
|
|
||||||
this.$http.post(`Docuwares/${this.id}/checkFile`, params)
|
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.hasDocuwareFile = res.data;
|
this.hasDocuwareFile = res.data;
|
||||||
this.isLoadingDocuware = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadDocuware() {
|
uploadDocuware() {
|
||||||
return this.$http.post(`Docuwares/${this.id}/upload`, {fileCabinet: 'deliveryClient', dialog: 'storeTicket'})
|
return this.$http.post(`Docuwares/${this.id}/upload`, {fileCabinet: 'deliveryNote'})
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('PDF uploaded!')));
|
.then(() => {
|
||||||
|
this.vnApp.showSuccess(this.$t('PDF sent!'));
|
||||||
|
this.$.balanceCreate.show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sendDocuwarePdfDeliveryNote($data) {
|
sendDocuwarePdfDeliveryNote($data) {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
Show Delivery Note...: Ver albarán...
|
Show Delivery Note...: Ver albarán...
|
||||||
Send Delivery Note...: Enviar albarán...
|
Send Delivery Note...: Enviar albarán...
|
||||||
as PDF: como PDF
|
as PDF: como PDF
|
||||||
as PDF Docuware: como PDF Docuware
|
as PDF signed: como PDF firmado
|
||||||
as CSV: como CSV
|
as CSV: como CSV
|
||||||
as PDF without prices: como PDF sin precios
|
as PDF without prices: como PDF sin precios
|
||||||
Send PDF: Enviar PDF
|
Send PDF: Enviar PDF
|
||||||
|
Send PDF to tablet: Enviar PDF a tablet
|
||||||
Send CSV: Enviar CSV
|
Send CSV: Enviar CSV
|
||||||
Send CSV Delivery Note: Enviar albarán en CSV
|
Send CSV Delivery Note: Enviar albarán en CSV
|
||||||
Send PDF Delivery Note: Enviar albarán en PDF
|
Send PDF Delivery Note: Enviar albarán en PDF
|
||||||
|
@ -14,3 +15,4 @@ Invoice sent: Factura enviada
|
||||||
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
|
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
|
||||||
Transfer client: Transferir cliente
|
Transfer client: Transferir cliente
|
||||||
SMS Notify changes: SMS Notificar cambios
|
SMS Notify changes: SMS Notificar cambios
|
||||||
|
PDF sent!: ¡PDF enviado!
|
||||||
|
|
Loading…
Reference in New Issue