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

46 lines
1023 B
JavaScript

import './style.scss';
export default new Class({
Extends: Hedera.Form,
Template: require('./ui.xml'),
async onTicketChange(ticket) {
if (!ticket.value) return;
await this.conn.execQuery('CALL myTicket_logAccess(#ticket)',
{ticket: ticket.value});
},
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';
},
});