diff --git a/debian/changelog b/debian/changelog
index cc4c36cb..dafe733e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-hedera-web (1.406.12) stable; urgency=low
+hedera-web (1.406.13) stable; urgency=low
* Initial Release.
diff --git a/forms/ecomerce/invoices/invoices.js b/forms/ecomerce/invoices/invoices.js
index bcb784c0..cfebd6fe 100644
--- a/forms/ecomerce/invoices/invoices.js
+++ b/forms/ecomerce/invoices/invoices.js
@@ -1,21 +1,30 @@
-Hedera.Invoices = new Class
-({
- Extends: Hedera.Form
+Hedera.Invoices = new Class({
+ Extends: Hedera.Form,
- ,onDownloadClick: function (column, invoiceId)
- {
- if (!invoiceId)
- return;
-
- var params = {
- 'srv': 'rest:dms/invoice'
- ,'invoice': invoiceId
- ,'token': this.conn.token
- };
-
- var url = '?'+ Vn.Url.makeUri (params);
- window.open (url, '_blank');
+ donwloadRenderer: function(column, invoice) {
+ var invoiceId = invoice.get('id');
+
+ if (invoice.get('pdf') && invoiceId) {
+ var params = {
+ srv: 'rest:dms/invoice',
+ invoice: invoiceId,
+ token: this.conn.token
+ };
+
+ Object.assign(column, {
+ tip: _('Download PDF'),
+ disabled: false,
+ icon: 'download',
+ href: '?'+ Vn.Url.makeUri (params)
+ });
+ } else
+ Object.assign(column, {
+ tip: _('Request the invoice to your salesperson'),
+ disabled: true,
+ icon: 'warning',
+ href: null
+ });
}
});
diff --git a/forms/ecomerce/invoices/locale/ca.yml b/forms/ecomerce/invoices/locale/ca.yml
index 25a01c0a..7e7fa462 100644
--- a/forms/ecomerce/invoices/locale/ca.yml
+++ b/forms/ecomerce/invoices/locale/ca.yml
@@ -3,3 +3,4 @@ Serial: Sèrie
Date: Data
Import: Import
Donwload PDF: Descarregar PDF
+Request the invoice to your salesperson: Sol·licita la factura al teu comercial
diff --git a/forms/ecomerce/invoices/locale/en.yml b/forms/ecomerce/invoices/locale/en.yml
index a5e68780..7b673d0e 100644
--- a/forms/ecomerce/invoices/locale/en.yml
+++ b/forms/ecomerce/invoices/locale/en.yml
@@ -3,3 +3,4 @@ Serial: Serial
Date: Date
Import: Import
Download PDF: Download PDF
+Request the invoice to your salesperson: Request the invoice to your salesperson
diff --git a/forms/ecomerce/invoices/locale/es.yml b/forms/ecomerce/invoices/locale/es.yml
index 9dd52f37..39a956ca 100644
--- a/forms/ecomerce/invoices/locale/es.yml
+++ b/forms/ecomerce/invoices/locale/es.yml
@@ -3,3 +3,4 @@ Serial: Serie
Date: Fecha
Import: Importe
Download PDF: Descargar PDF
+Request the invoice to your salesperson: Solicita la factura a tu comercial
diff --git a/forms/ecomerce/invoices/locale/fr.yml b/forms/ecomerce/invoices/locale/fr.yml
index 4797e19b..2197fa75 100644
--- a/forms/ecomerce/invoices/locale/fr.yml
+++ b/forms/ecomerce/invoices/locale/fr.yml
@@ -3,3 +3,4 @@ Serial: Série
Date: Date
Import: Montant
Donwload PDF: Télécharger le PDF
+Request the invoice to your salesperson: Demander la facture à votre commercial
diff --git a/forms/ecomerce/invoices/locale/pt.yml b/forms/ecomerce/invoices/locale/pt.yml
index 97d610c3..adf3270b 100644
--- a/forms/ecomerce/invoices/locale/pt.yml
+++ b/forms/ecomerce/invoices/locale/pt.yml
@@ -3,3 +3,4 @@ Serial: Serie
Date: Data
Import: Importe
Download PDF: Baixar PDF
+Request the invoice to your salesperson: Solicite a fatura ao seu comercial
diff --git a/forms/ecomerce/invoices/ui.xml b/forms/ecomerce/invoices/ui.xml
index 3e6a6a81..70378c1d 100644
--- a/forms/ecomerce/invoices/ui.xml
+++ b/forms/ecomerce/invoices/ui.xml
@@ -7,7 +7,7 @@
- SELECT id, ref, issued, amount
+ SELECT id, ref, issued, amount, pdf
FROM myInvoice
ORDER BY issued DESC
LIMIT 100
@@ -16,10 +16,8 @@
+ renderer="donwloadRenderer"
+ target="_blank"/>
diff --git a/js/htk/column.js b/js/htk/column.js
index 6959aa36..fbd701e3 100644
--- a/js/htk/column.js
+++ b/js/htk/column.js
@@ -85,10 +85,9 @@ module.exports = new Class
/**
* Draws the cell and returns its associated td.
*
- * @param {HTMLTableRow} tr the table row
* @return {HTMLTableData} the rendered cell
**/
- ,render: function (tr)
+ ,render: function ()
{
var td = this.td.cloneNode (true);
diff --git a/js/htk/column/button.js b/js/htk/column/button.js
index c605a7d3..e799a121 100644
--- a/js/htk/column/button.js
+++ b/js/htk/column/button.js
@@ -1,65 +1,78 @@
-module.exports = new Class
-({
- Extends: Htk.Column
- ,Tag: 'htk-column-button'
- ,Properties:
- {
- image:
- {
+module.exports = new Class({
+ Extends: Htk.Column,
+ Tag: 'htk-column-button',
+ Properties: {
+ image: {
type: String
,value: null
},
- icon:
- {
+ icon: {
type: String
- ,set: function (x)
+ ,set: function(x)
{
this._icon = x;
- this.image = 'image/icon/light/'+ x + '.svg';
+ this.image = 'image/icon/light/'+ x +'.svg';
}
- ,get: function ()
+ ,get: function()
{
return this._icon;
}
},
- tip:
- {
- type: String
- ,value: null
+ tip: {
+ type: String,
+ value: null
+ },
+ disabled: {
+ type: Boolean,
+ value: false
+ },
+ href: {
+ type: String,
+ value: null
+ },
+ target: {
+ type: String,
+ value: ''
}
- }
+ },
- ,initialize: function (props)
- {
+ initialize: function(props) {
this._cssClass = 'cell-button';
- this.parent (props);
- }
+ this.parent(props);
+ },
- ,render: function (tr)
- {
- var td = this.parent (tr);
+ render: function(tr) {
+ var td = this.parent(tr);
- var button = this.createElement ('button');
- button.addEventListener ('click',
- this.buttonClicked.bind (this, this.value, tr, button));
- td.appendChild (button);
+ var button;
+
+ if (this.href == null) {
+ button = this.createElement('button');
+ button.addEventListener('click',
+ this.buttonClicked.bind(this, this.value, tr, button));
+ } else {
+ button = this.createElement('a');
+ button.href = this.href;
+ button.target = this.target;
+ }
- var img = this.createElement ('img');
+ button.disabled = this.disabled;
+ td.appendChild(button);
+
+ var img = this.createElement('img');
img.src = this.image;
- button.appendChild (img);
+ button.appendChild(img);
- if (this.tip)
- {
+ if (this.tip) {
button.title = _(this.tip);
img.title = _(this.tip);
}
return td;
- }
+ },
- ,buttonClicked: function (value, tr, button)
- {
- this.signalEmit ('clicked', value, tr.rowIndex - 1, button);
+ buttonClicked: function(value, tr, button) {
+ this.signalEmit('clicked', value, tr.rowIndex - 1, button);
}
});
diff --git a/js/htk/grid.js b/js/htk/grid.js
index da578b03..9964ddf4 100644
--- a/js/htk/grid.js
+++ b/js/htk/grid.js
@@ -108,7 +108,7 @@ module.exports = new Class
this.showNoRecordsFound ();
}
- ,onRowInsert: function (model, row)
+ ,onRowInsert: function (model)
{
this.buildRow (1);
}
@@ -225,7 +225,7 @@ module.exports = new Class
this._node.appendChild (this.tbody);
}
- ,showNoRecordsFound: function (count)
+ ,showNoRecordsFound: function ()
{
if (this._model.numRows == 0)
this.showMessage (_('EmptyList'), 'clean');
diff --git a/js/htk/style.css b/js/htk/style.css
index 19f6d781..34585f6e 100644
--- a/js/htk/style.css
+++ b/js/htk/style.css
@@ -99,26 +99,32 @@ th.cell-radio
}
td.cell-button
{
- max-width: 2em;
+ max-width: 1em;
text-align: center;
}
-td.cell-button > button
+td.cell-button > button,
+td.cell-button > a
{
- margin: 0;
- padding: 0.5em;
+ display: inline-block;
+ margin: 0 auto;
+ padding: .5em;
border: none;
background-color: transparent;
- border-radius: 0.1em;
+ border-radius: .1em;
+ box-sizing: border-box;
}
-td.cell-button > button:hover
+td.cell-button > button:hover,
+td.cell-button > a:hover
{
background-color: rgba(1, 1, 1, 0.1);
}
td.cell-button img
{
height: 1.5em;
+ width: 1.5em;
display: block;
margin: auto;
+ padding: 0;
}
td.cell-image
{
diff --git a/package.json b/package.json
index d92e503a..eea3e638 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hedera-web",
- "version": "1.406.12",
+ "version": "1.406.13",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {