import './style.scss'; export default new Class({ Extends: Hedera.Form, Template: require('./ui.xml'), onTicketChange(ticket) { if (!ticket.value) return; var params = {ticket: ticket.value}; this.conn.execQuery('CALL myTicket_logAccess(#ticket)', null, params); }, onPrintClick() { let params = Vn.Url.makeUri({ access_token: this.conn.token, recipientId: this.gui.user.id, type: 'deliveryNote' }); window.open(`/api/Tickets/${this.hash.$.ticket}/delivery-note-pdf?${params}`); }, repeaterFunc(scope, form) { scope.$.discount.style.display = form.$.discount ? 'inline' : 'none'; }, discountSubtotal(line) { return line.quantity * line.price; }, subtotal(line) { var discount = line.discount; return this.discountSubtotal(line) * ((100 - discount) / 100); }, onServicesChanged(model) { this.$.services.node.style.display = model.numRows > 0 ? 'block' : 'none'; }, onPackagesChanged(model) { this.$.packages.node.style.display = model.numRows > 0 ? 'block' : 'none'; }, });