import './style.scss';

export default new Class({
	Extends: Hedera.Form,
	Template: require('./ui.xml'),
	
	donwloadRenderer(column, invoice) {
		var invoiceId = invoice.$.id;

		if (invoice.$.hasPdf && invoiceId) {
			var params = {
				srv: 'rest:dms/invoice',
				invoice: invoiceId,
				access_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
			});
	}
});