ordersprinter/webapp/elements/extra.js

45 lines
1.5 KiB
JavaScript

/**
*
*/
function newExtra(id, name, price) {
var extra = {
id:id,
name:name,
price: price,
createTableStructureLine:function (depth,audiofiles) {
if (id != null) {
var trline = "<tr id='extra_" + id + "'>"
+ "<td><input id='extraname_" + id + "' type='text' class='extraname'></input>"
+ "<td><input id='extraprice_" + id + "' type='text' class='extraprice'></input>"
+ "<td><button id='delextra_" + id + "' class='extracmd'>&minus;</button>"
+ "<td><button id='applyextra_" + id + "' class='extracmd'>&crarr;</button>"
+ "</tr>";
return trline;
} else {
var trline = "<tr id='extra_new_" + id + "'>"
+ "<td><input id='newextraname' type='text' class='extraname'></input>"
+ "<td><input id='newextraprice' type='text' class='extraprice'></input>"
+ "<td><button id='newextra_0' class='extracmd'>+</button>"
+ "</tr>";
return trline;
}
},
insertValuesIntoMenuTable:function() {
$("#extra_" + this.id + " input.extraname").val(this.name);
if (this.price != null) {
$("#extra_" + this.id + " input.extraprice").val(this.price);
}
},
createApplyArea:function(idApply) {
var txt = '<p><fieldset>'
+ '<div><button id="' + idApply + '" type="submit" data-theme="b" class="extracmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '</fieldset></p>';
return txt;
},
};
return extra;
}