//Polyfilling if (!String.prototype.trim) { //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim String.prototype.trim = function () { return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); }; } if (!Array.prototype.swap) { Array.prototype.swap = function(a,b){ //don't attempt to swap if indexes invalid if(Math.min(a,b)<0 || Math.max(a,b)>=this.length) return this; //indexes are valid, then swap var tmp = this[a]; this[a] = this[b]; this[b] = tmp; return this; } } if (!Array.prototype.remove) { Array.prototype.remove = function(a){ //don't attempt to swap if index is invalid if(a<0 || a>=this.length) return undefined; //index is valid, then remove return this.splice(a, 1)[0]; } } if (!Array.prototype.contains) { Array.prototype.contains = function(a){ var ret = false this.forEach(function(elem){ if(elem===a) ret = true; }); return ret; } } if (!String.prototype.escapeHtml) { // http://stackoverflow.com/a/6234804 String.prototype.escapeHtml = function () { return this .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); }; } // End of Polyfilling function escapeHtml(unsafe){ // http://stackoverflow.com/a/6234804 return unsafe .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function ensureArray(variable){ if( variable !== null && typeof(variable) === "object" && ( variable.constructor === Array || ( variable.prop && variable.prop.constructor === Array ) ) ) return variable; else return new Array(); } var pedidos = []; var pedidoCache = {}; function viewUpdate(apiid){ var v = ''; if(typeof(apiid)!=='number'){ v+='
'; v+='Número do pedido | '; v+='Cliente | '; v+='Visualizar | '; v+='
---|---|---|
'+(pedido.noped.escapeHtml())+' | '; v+=''+(pedido.cliente.escapeHtml())+' | '; v+='Visualizar | '; v+='
Número do pedido: '+pedido.noped.escapeHtml()+'
'; v+='Cliente: '+pedido.cliente.escapeHtml()+'
'; v+='Itens:
'; v+='Código do item | '; v+='Descrição | '; v+='Marca | '; v+='Quantidade | '; v+='
---|---|---|---|
'+item.cod.escapeHtml()+' | '; v+=''+item.descr.escapeHtml()+' | '; v+=''+item.marca.escapeHtml()+' | '; v+=''+item.qtd.escapeHtml()+' | '; v+='
Nenhuma linha para exibir |