diff --git a/packages/client/src/app/inventory-management/invoice-tool/invoice-parse/invoice-parse.component.ts b/packages/client/src/app/inventory-management/invoice-tool/invoice-parse/invoice-parse.component.ts
index d115164b5..4f2fe3800 100644
--- a/packages/client/src/app/inventory-management/invoice-tool/invoice-parse/invoice-parse.component.ts
+++ b/packages/client/src/app/inventory-management/invoice-tool/invoice-parse/invoice-parse.component.ts
@@ -40,9 +40,9 @@ export class InvoiceParse implements OnInit {
onDrop(e) {
e.preventDefault(); //;// évite d'ouvrir le fichier recherché
- var files:File = e.dataTransfer.files;
+ const files: File = e.dataTransfer.files;
Object.keys(files).forEach((key) => {
- let file: File = files[key];
+ const file: File = files[key];
this.invoiceParseService.fromFiletoText(file);
this.invoiceService.addInvoice(file);
});
diff --git a/packages/client/src/app/inventory-management/invoice-tool/invoice-service/invoice-parse.service.ts b/packages/client/src/app/inventory-management/invoice-tool/invoice-service/invoice-parse.service.ts
index 2582394b1..9493edd62 100644
--- a/packages/client/src/app/inventory-management/invoice-tool/invoice-service/invoice-parse.service.ts
+++ b/packages/client/src/app/inventory-management/invoice-tool/invoice-service/invoice-parse.service.ts
@@ -11,8 +11,8 @@ export class InvoiceParseService {
nbplastinvoice = 0;
async fromFiletoText(invoice: File){
- var url = URL.createObjectURL(invoice);
- let oneinvoice = await this.gettext(url);
+ const url = URL.createObjectURL(invoice);
+ const oneinvoice = await this.gettext(url);
this.nbplastinvoice = oneinvoice.length;
for(let i=0;i=0;i--){
listothers.push(listinvoices.splice(toremove[i],1));
}
-
- //Parsing
+
+ //Parsing
for(let i = 0; i=0 || listinvoicesparse[i].indexOf('°')>=0){
@@ -78,21 +78,21 @@ export class InvoiceParseService {
listinvoices[i]=listinvoicesparse.join(' ');
}
- var listarticles = [];
+ const listarticles = [];
for(let i=0;i=0;i--){
@@ -146,18 +146,18 @@ export class InvoiceParseService {
gettext(pdfUrl){
PDFJS.GlobalWorkerOptions.workerSrc = PDFJSWorker;
- var pdf = PDFJS.getDocument(pdfUrl).promise;
+ const pdf = PDFJS.getDocument(pdfUrl).promise;
return pdf.then(function(pdf) { // get all pages text
- var maxPages = pdf.numPages;
- var countPromises = []; // collecting all page promises
- for (var j = 1; j <= maxPages; j++) {
- var page = pdf.getPage(j);
-
+ const maxPages = pdf.numPages;
+ const countPromises = []; // collecting all page promises
+ for (let j = 1; j <= maxPages; j++) {
+ const page = pdf.getPage(j);
+
//var txt = "";
countPromises.push(page.then(function(page) { // add page promise
- var textContent = page.getTextContent();
+ const textContent = page.getTextContent();
return textContent.then(function(text){ // return content promise
- return text.items.map(function (s) { return s.str; }).join(''); // value page text
+ return text.items.map(function (s) { return s.str; }).join(''); // value page text
});
}));
}
@@ -167,4 +167,4 @@ export class InvoiceParseService {
});
});
}
-}
\ No newline at end of file
+}
diff --git a/packages/client/src/app/inventory-management/invoice-tool/invoice-tool-routing.module.ts b/packages/client/src/app/inventory-management/invoice-tool/invoice-tool-routing.module.ts
index d25072a26..69ed44bba 100644
--- a/packages/client/src/app/inventory-management/invoice-tool/invoice-tool-routing.module.ts
+++ b/packages/client/src/app/inventory-management/invoice-tool/invoice-tool-routing.module.ts
@@ -8,7 +8,7 @@ const routes: Routes = [
path: '',
component: InvoiceParse,
canActivate: [NgxPermissionsGuard],
- //data: { permissions: { only: ['inventory-management:products:create'] } },
+ data: { permissions: { only: ['inventory-management:invoice-tool'] } },
},
];
diff --git a/packages/client/src/app/layout/nav-menu/nav-menu.component.ts b/packages/client/src/app/layout/nav-menu/nav-menu.component.ts
index 83c1fefb4..f55bfa2d2 100644
--- a/packages/client/src/app/layout/nav-menu/nav-menu.component.ts
+++ b/packages/client/src/app/layout/nav-menu/nav-menu.component.ts
@@ -64,7 +64,11 @@ const NAV_MENUS: SubMenu[] = [
{ name: 'Fournisseurs', route: '/inventory-management/providers' },
{ name: 'Produits', route: '/inventory-management/products' },
{ name: 'Rayons', route: '/inventory-management/shelves' },
- { name: 'Outil StoK-Fêt', route: '/inventory-management/invoice-tool' },
+ {
+ name: 'Outil StoK-Fêt',
+ route: '/inventory-management/invoice-tool',
+ permissions: ['inventory-management:invoice-tool']
+ },
],
},
{
diff --git a/packages/server/app/constants.js b/packages/server/app/constants.js
index bd00f5554..f60537a0f 100644
--- a/packages/server/app/constants.js
+++ b/packages/server/app/constants.js
@@ -39,7 +39,7 @@ module.exports = {
'template:read',
'template:write',
- 'inventory-managment:invoice-tool',
+ 'inventory-management:invoice-tool',
],
/**