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

46 lines
1023 B
JavaScript
Raw Normal View History

2022-11-16 01:44:39 +00:00
import './style.scss';
2022-11-16 01:44:39 +00:00
export default new Class({
2018-08-30 13:26:05 +00:00
Extends: Hedera.Form,
2022-11-16 01:44:39 +00:00
Template: require('./ui.xml'),
2022-11-28 08:51:31 +00:00
async onTicketChange(ticket) {
if (!ticket.value) return;
await this.conn.execQuery('CALL myTicket_logAccess(#ticket)',
{ticket: ticket.value});
2018-08-30 13:26:05 +00:00
},
2022-11-16 01:46:44 +00:00
onPrintClick() {
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-11-16 01:46:44 +00:00
repeaterFunc(scope, form) {
2022-06-18 21:04:34 +00:00
scope.$.discount.style.display = form.$.discount ? 'inline' : 'none';
2018-08-30 13:26:05 +00:00
},
2022-11-16 01:46:44 +00:00
discountSubtotal(line) {
2022-06-18 21:04:34 +00:00
return line.quantity * line.price;
2018-08-30 13:26:05 +00:00
},
2022-11-16 01:46:44 +00:00
subtotal(line) {
2022-06-18 21:04:34 +00:00
var discount = line.discount;
return this.discountSubtotal(line) * ((100 - discount) / 100);
},
2022-11-16 01:46:44 +00:00
onServicesChanged(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
2022-11-16 01:46:44 +00:00
onPackagesChanged(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';
},
});