0
1
Fork 0
hedera-web-mindshore/forms/ecomerce/ticket/ticket.js

46 lines
1.0 KiB
JavaScript

Hedera.Ticket = new Class({
Extends: Hedera.Form,
onTicketChange: function(ticket) {
if (!ticket.value)
return;
var params = {ticket: ticket.value};
this.conn.execQuery('CALL myTicket_logAccess(#ticket)', null, params);
},
onPrintClick: function() {
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: function(scope, form) {
scope.$.discount.style.display = form.$.discount ? 'inline' : 'none';
},
discountSubtotal: function(line) {
return line.quantity * line.price;
},
subtotal: function(line) {
var discount = line.discount;
return this.discountSubtotal(line) * ((100 - discount) / 100);
},
onServicesChanged: function(model) {
this.$.services.node.style.display =
model.numRows > 0 ? 'block' : 'none';
},
onPackagesChanged: function(model) {
this.$.packages.node.style.display =
model.numRows > 0 ? 'block' : 'none';
},
});