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

46 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-08-30 13:26:05 +00:00
Hedera.Ticket = new Class({
Extends: Hedera.Form,
2018-08-30 13:26:05 +00:00
onTicketChange: function(ticket) {
2016-10-27 11:22:04 +00:00
if (!ticket.value)
return;
2022-05-30 01:30:33 +00:00
var params = {ticket: ticket.value};
this.conn.execQuery('CALL myTicket_logAccess(#ticket)', null, params);
2018-08-30 13:26:05 +00:00
},
onPrintClick: function() {
2022-05-05 13:56:17 +00:00
let params = Vn.Url.makeUri({
2022-10-10 11:22:17 +00:00
access_token: this.conn.token,
2022-05-05 13:56:17 +00:00
recipientId: this.gui.user.id,
type: 'deliveryNote'
});
2022-11-10 20:57:43 +00:00
window.open(`/api/Tickets/${this.hash.$.ticket}/delivery-note-pdf?${params}`);
2018-08-30 13:26:05 +00:00
},
2022-05-05 13:56:17 +00:00
2022-06-18 21:04:34 +00:00
repeaterFunc: function(scope, form) {
scope.$.discount.style.display = form.$.discount ? 'inline' : 'none';
2018-08-30 13:26:05 +00:00
},
2022-06-18 21:04:34 +00:00
discountSubtotal: function(line) {
return line.quantity * line.price;
2018-08-30 13:26:05 +00:00
},
2022-06-18 21:04:34 +00:00
subtotal: function(line) {
var discount = line.discount;
return this.discountSubtotal(line) * ((100 - discount) / 100);
},
onServicesChanged: function(model) {
2022-05-28 01:18:06 +00:00
this.$.services.node.style.display =
model.numRows > 0 ? 'block' : 'none';
},
2018-08-30 13:26:05 +00:00
onPackagesChanged: function(model) {
2022-05-28 01:18:06 +00:00
this.$.packages.node.style.display =
2018-01-05 12:57:35 +00:00
model.numRows > 0 ? 'block' : 'none';
},
});