Download disabled for unavailable invoice PDFs
This commit is contained in:
parent
81a31a8674
commit
1395532b6c
|
@ -1,4 +1,4 @@
|
||||||
hedera-web (1.406.12) stable; urgency=low
|
hedera-web (1.406.13) stable; urgency=low
|
||||||
|
|
||||||
* Initial Release.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,30 @@
|
||||||
|
|
||||||
Hedera.Invoices = new Class
|
Hedera.Invoices = new Class({
|
||||||
({
|
Extends: Hedera.Form,
|
||||||
Extends: Hedera.Form
|
|
||||||
|
|
||||||
,onDownloadClick: function (column, invoiceId)
|
donwloadRenderer: function(column, invoice) {
|
||||||
{
|
var invoiceId = invoice.get('id');
|
||||||
if (!invoiceId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var params = {
|
if (invoice.get('pdf') && invoiceId) {
|
||||||
'srv': 'rest:dms/invoice'
|
var params = {
|
||||||
,'invoice': invoiceId
|
srv: 'rest:dms/invoice',
|
||||||
,'token': this.conn.token
|
invoice: invoiceId,
|
||||||
};
|
token: this.conn.token
|
||||||
|
};
|
||||||
|
|
||||||
var url = '?'+ Vn.Url.makeUri (params);
|
Object.assign(column, {
|
||||||
window.open (url, '_blank');
|
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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,4 @@ Serial: Sèrie
|
||||||
Date: Data
|
Date: Data
|
||||||
Import: Import
|
Import: Import
|
||||||
Donwload PDF: Descarregar PDF
|
Donwload PDF: Descarregar PDF
|
||||||
|
Request the invoice to your salesperson: Sol·licita la factura al teu comercial
|
||||||
|
|
|
@ -3,3 +3,4 @@ Serial: Serial
|
||||||
Date: Date
|
Date: Date
|
||||||
Import: Import
|
Import: Import
|
||||||
Download PDF: Download PDF
|
Download PDF: Download PDF
|
||||||
|
Request the invoice to your salesperson: Request the invoice to your salesperson
|
||||||
|
|
|
@ -3,3 +3,4 @@ Serial: Serie
|
||||||
Date: Fecha
|
Date: Fecha
|
||||||
Import: Importe
|
Import: Importe
|
||||||
Download PDF: Descargar PDF
|
Download PDF: Descargar PDF
|
||||||
|
Request the invoice to your salesperson: Solicita la factura a tu comercial
|
||||||
|
|
|
@ -3,3 +3,4 @@ Serial: Série
|
||||||
Date: Date
|
Date: Date
|
||||||
Import: Montant
|
Import: Montant
|
||||||
Donwload PDF: Télécharger le PDF
|
Donwload PDF: Télécharger le PDF
|
||||||
|
Request the invoice to your salesperson: Demander la facture à votre commercial
|
||||||
|
|
|
@ -3,3 +3,4 @@ Serial: Serie
|
||||||
Date: Data
|
Date: Data
|
||||||
Import: Importe
|
Import: Importe
|
||||||
Download PDF: Baixar PDF
|
Download PDF: Baixar PDF
|
||||||
|
Request the invoice to your salesperson: Solicite a fatura ao seu comercial
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div>
|
<div>
|
||||||
<htk-grid show-header="false">
|
<htk-grid show-header="false">
|
||||||
<db-model property="model" id="tickets">
|
<db-model property="model" id="tickets">
|
||||||
SELECT id, ref, issued, amount
|
SELECT id, ref, issued, amount, pdf
|
||||||
FROM myInvoice
|
FROM myInvoice
|
||||||
ORDER BY issued DESC
|
ORDER BY issued DESC
|
||||||
LIMIT 100
|
LIMIT 100
|
||||||
|
@ -16,10 +16,8 @@
|
||||||
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
|
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
|
||||||
<htk-column-spin title="_Import" column="amount" unit="€" digits="2"/>
|
<htk-column-spin title="_Import" column="amount" unit="€" digits="2"/>
|
||||||
<htk-column-button
|
<htk-column-button
|
||||||
column="id"
|
renderer="donwloadRenderer"
|
||||||
icon="download"
|
target="_blank"/>
|
||||||
tip="_Download PDF"
|
|
||||||
on-clicked="onDownloadClick"/>
|
|
||||||
</htk-grid>
|
</htk-grid>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -85,10 +85,9 @@ module.exports = new Class
|
||||||
/**
|
/**
|
||||||
* Draws the cell and returns its associated td.
|
* Draws the cell and returns its associated td.
|
||||||
*
|
*
|
||||||
* @param {HTMLTableRow} tr the table row
|
|
||||||
* @return {HTMLTableData} the rendered cell
|
* @return {HTMLTableData} the rendered cell
|
||||||
**/
|
**/
|
||||||
,render: function (tr)
|
,render: function ()
|
||||||
{
|
{
|
||||||
var td = this.td.cloneNode (true);
|
var td = this.td.cloneNode (true);
|
||||||
|
|
||||||
|
|
|
@ -1,65 +1,78 @@
|
||||||
|
|
||||||
module.exports = new Class
|
module.exports = new Class({
|
||||||
({
|
Extends: Htk.Column,
|
||||||
Extends: Htk.Column
|
Tag: 'htk-column-button',
|
||||||
,Tag: 'htk-column-button'
|
Properties: {
|
||||||
,Properties:
|
image: {
|
||||||
{
|
|
||||||
image:
|
|
||||||
{
|
|
||||||
type: String
|
type: String
|
||||||
,value: null
|
,value: null
|
||||||
},
|
},
|
||||||
icon:
|
icon: {
|
||||||
{
|
|
||||||
type: String
|
type: String
|
||||||
,set: function (x)
|
,set: function(x)
|
||||||
{
|
{
|
||||||
this._icon = 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;
|
return this._icon;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tip:
|
tip: {
|
||||||
{
|
type: String,
|
||||||
type: String
|
value: null
|
||||||
,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._cssClass = 'cell-button';
|
||||||
this.parent (props);
|
this.parent(props);
|
||||||
}
|
},
|
||||||
|
|
||||||
,render: function (tr)
|
render: function(tr) {
|
||||||
{
|
var td = this.parent(tr);
|
||||||
var td = this.parent (tr);
|
|
||||||
|
|
||||||
var button = this.createElement ('button');
|
var button;
|
||||||
button.addEventListener ('click',
|
|
||||||
this.buttonClicked.bind (this, this.value, tr, button));
|
|
||||||
td.appendChild (button);
|
|
||||||
|
|
||||||
var img = this.createElement ('img');
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.disabled = this.disabled;
|
||||||
|
td.appendChild(button);
|
||||||
|
|
||||||
|
var img = this.createElement('img');
|
||||||
img.src = this.image;
|
img.src = this.image;
|
||||||
button.appendChild (img);
|
button.appendChild(img);
|
||||||
|
|
||||||
if (this.tip)
|
if (this.tip) {
|
||||||
{
|
|
||||||
button.title = _(this.tip);
|
button.title = _(this.tip);
|
||||||
img.title = _(this.tip);
|
img.title = _(this.tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return td;
|
return td;
|
||||||
}
|
},
|
||||||
|
|
||||||
,buttonClicked: function (value, tr, button)
|
buttonClicked: function(value, tr, button) {
|
||||||
{
|
this.signalEmit('clicked', value, tr.rowIndex - 1, button);
|
||||||
this.signalEmit ('clicked', value, tr.rowIndex - 1, button);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -108,7 +108,7 @@ module.exports = new Class
|
||||||
this.showNoRecordsFound ();
|
this.showNoRecordsFound ();
|
||||||
}
|
}
|
||||||
|
|
||||||
,onRowInsert: function (model, row)
|
,onRowInsert: function (model)
|
||||||
{
|
{
|
||||||
this.buildRow (1);
|
this.buildRow (1);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ module.exports = new Class
|
||||||
this._node.appendChild (this.tbody);
|
this._node.appendChild (this.tbody);
|
||||||
}
|
}
|
||||||
|
|
||||||
,showNoRecordsFound: function (count)
|
,showNoRecordsFound: function ()
|
||||||
{
|
{
|
||||||
if (this._model.numRows == 0)
|
if (this._model.numRows == 0)
|
||||||
this.showMessage (_('EmptyList'), 'clean');
|
this.showMessage (_('EmptyList'), 'clean');
|
||||||
|
|
|
@ -99,26 +99,32 @@ th.cell-radio
|
||||||
}
|
}
|
||||||
td.cell-button
|
td.cell-button
|
||||||
{
|
{
|
||||||
max-width: 2em;
|
max-width: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
td.cell-button > button
|
td.cell-button > button,
|
||||||
|
td.cell-button > a
|
||||||
{
|
{
|
||||||
margin: 0;
|
display: inline-block;
|
||||||
padding: 0.5em;
|
margin: 0 auto;
|
||||||
|
padding: .5em;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
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);
|
background-color: rgba(1, 1, 1, 0.1);
|
||||||
}
|
}
|
||||||
td.cell-button img
|
td.cell-button img
|
||||||
{
|
{
|
||||||
height: 1.5em;
|
height: 1.5em;
|
||||||
|
width: 1.5em;
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
td.cell-image
|
td.cell-image
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hedera-web",
|
"name": "hedera-web",
|
||||||
"version": "1.406.12",
|
"version": "1.406.13",
|
||||||
"description": "Verdnatura web page",
|
"description": "Verdnatura web page",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Reference in New Issue