Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var hacer_tables = {
- bt_tables: function(id_tabla){
- $.extend($.tablesorter.themes.bootstrap, {
- // these classes are added to the table. To see other table classes available,
- // look here: http://twitter.github.com/bootstrap/base-css.html#tables
- table : 'table table-bordered',
- header : 'bootstrap-header', // give the header a gradient background
- footerRow : '',
- footerCells: '',
- icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
- sortNone : 'bootstrap-icon-unsorted',
- sortAsc : 'icon-chevron-up',
- sortDesc : 'icon-chevron-down',
- active : '', // applied when column is sorted
- hover : '', // use custom css here - bootstrap class may not override it
- filterRow : '', // filter row class
- even : '', // odd row zebra striping
- odd : '' // even row zebra striping
- });
- $(id_tabla).tablesorter(
- {
- // this will apply the bootstrap theme if "uitheme" widget is included
- // the widgetOptions.uitheme is no longer required to be set
- theme : "bootstrap",
- widthFixed: true,
- headerTemplate : '{content} {icon}', // new in v2.7. Needed to add the bootstrap icon!
- // widget code contained in the jquery.tablesorter.widgets.js file
- // use the zebra stripe widget if you plan on hiding any rows (filter widget)
- widgets : [ "uitheme", "filter", "zebra" ],
- widgetOptions : {
- // using the default zebra striping class name, so it actually isn't included in the theme variable above
- // this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden
- zebra : ["even", "odd"],
- // reset filters button
- filter_reset : ".reset"
- // set the uitheme widget to use the bootstrap theme class names
- // this is no longer required, if theme is set
- // ,uitheme : "bootstrap"
- }
- }
- ).tablesorterPager({
- // target the pager markup - see the HTML block below
- container: $(".pager"),
- // target the pager page select dropdown - choose a page
- cssGoto : ".pagenum",
- // remove rows from the table to speed up the sort of large tables.
- // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
- removeRows: false,
- // output string - default is '{page}/{totalPages}';
- // possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
- output: '{startRow} - {endRow} / {filteredRows} ({totalRows})'
- });
- },
- big_tables: function(id_tabla){
- $.extend($.tablesorter.themes.bootstrap, {
- // these classes are added to the table. To see other table classes available,
- // look here: http://twitter.github.com/bootstrap/base-css.html#tables
- table : 'table table-bordered',
- header : 'bootstrap-header', // give the header a gradient background
- footerRow : '',
- footerCells: '',
- icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
- sortNone : 'bootstrap-icon-unsorted',
- sortAsc : 'icon-chevron-up',
- sortDesc : 'icon-chevron-down',
- active : '', // applied when column is sorted
- hover : '', // use custom css here - bootstrap class may not override it
- filterRow : '', // filter row class
- even : '', // odd row zebra striping
- odd : '' // even row zebra striping
- });
- $(id_tabla).tablesorter(
- {
- // this will apply the bootstrap theme if "uitheme" widget is included
- // the widgetOptions.uitheme is no longer required to be set
- theme : "bootstrap",
- widthFixed: true,
- headerTemplate : '{content} {icon}', // new in v2.7. Needed to add the bootstrap icon!
- // widget code contained in the jquery.tablesorter.widgets.js file
- // use the zebra stripe widget if you plan on hiding any rows (filter widget)
- widgets : [ "uitheme", "filter", "zebra" ],
- widgetOptions : {
- // using the default zebra striping class name, so it actually isn't included in the theme variable above
- // this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden
- zebra : ["even", "odd"],
- // reset filters button
- filter_reset : ".reset"
- // set the uitheme widget to use the bootstrap theme class names
- // this is no longer required, if theme is set
- // ,uitheme : "bootstrap"
- }
- }
- ).tablesorterPager({
- // target the pager markup - see the HTML block below
- container: $(".pager"),
- // target the pager page select dropdown - choose a page
- cssGoto : ".pagenum",
- // remove rows from the table to speed up the sort of large tables.
- // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
- removeRows: true,
- // output string - default is '{page}/{totalPages}';
- // possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
- output: '{startRow} - {endRow} / {filteredRows} ({totalRows})'
- });
- }
- }
- var control_submit = {
- no_enter: function(classname) {
- $(classname).keypress(function(e){
- if ( e.which == 13 ) return false;
- if ( e.which == 13 ) e.preventDefault();
- });
- }
- }
- var esconder_comunes = {
- identificadores: function(ids){
- $(ids).hide();
- }
- }
- var pedidos = {
- //el codigo es asqueroso,
- //pero no puedo meter python aqui
- //y no pienso perder tiempo con pyjs
- pro_repopular: function(){
- $('.thumbnails').html('');
- for (var index in pgh){
- $('.thumbnails').append(
- this.pro_html(pgh[index])
- );
- }
- this.pre_cantidades('.cant_fijas');
- control_submit.no_enter('.noenter');
- },
- pro_html: function(producto){
- //esto es bastante aterrador, pero
- //no encuentro otra manera, de no recargar la pagina o_O
- outhtml = '<li class="span3">'+
- '<div class="thumbnail">'+
- ' <img src="'+producto.imagen+'" alt="product 1" class="img-rounded imgpp" >'+
- ' <div class="caption">'+
- ' <h4 style="text-align: center; color: #ffffff">'+producto.descripcion+'</h4>'+
- ' <div class="btn-group-wrap">'+
- ' <div class="btn-toolbar">'+
- ' <div class="btn-group">'+
- ' <button class="btn btn-primary btn-med cant_fijas" data-producto="'+producto.pk+'">1</button>'+
- ' </div>'+
- ' <div class="btn-group">'+
- ' <button class="btn btn-info btn-med cant_fijas" data-producto="'+producto.pk+'">2</button>'+
- ' </div>'+
- ' <div class="btn-group">'+
- ' <button class="btn btn-success btn-med cant_fijas" data-producto="'+producto.pk+'">3</button>'+
- ' </div>'+
- ' </div>'+
- ' </div>'+
- ' <div class="btn-group-wrap">'+
- ' <input id="'+producto.pk+'_can" type="number" class="input-small cant_deli noenter" min="1" max="20" style="padding-bottom: 1px; margin-bottom: 1px; font-size: 20px; height: 40px;" />'+
- ' </div>'+
- ' <div class="btn-group-wrap">'+
- ' <div class="btn-toolbar">'+
- ' <div class="btn-group">'+
- ' <button class="btn btn-warning btn-medc" data-producto="'+producto.pk+'">PEDIDO</button>'+
- ' </div>'+
- ' <div class="btn-group">'+
- ' <button class="btn btn-danger btn-medc" data-producto="'+producto.pk+'">CONFIRMAR</button>'+
- ' </div>'+
- ' </div>'+
- ' </div>'+
- ' </div>'+
- '</div>'+
- '</li>'
- return outhtml
- },
- pre_cantidades: function(clase){
- $(clase).on('click', function(evt){
- cantidad = evt.target.innerHTML;
- pkpro = evt.target.getAttribute("data-producto");
- console.log(pkpro);
- inputo = $("#"+pkpro+"_can");
- pedidos.cantidades_fijas({ pkpro: pkpro,
- inputo: inputo,
- cantidad: cantidad}
- );
- });
- },
- realizarlo: function(pobj){
- $.get(pobj.url, pobj.data, function(response){
- $(pobj.target).html(response);
- });
- },
- cantidades_fijas: function(obj) {
- $("#ac_"+obj.pkpro).show();
- obj.inputo.val(obj.cantidad);
- },
- buscar: function(pkpr){
- var enc = false;
- mensajes.ini_aba();
- for (var index in pgl){
- if (pgl[index].hasOwnProperty(pkpr)) {
- var producto = pgl[index][pkpr];
- enc = true;
- break;
- }
- }
- if (enc === true) {
- $('.thumbnails').html(
- this.pro_html(producto)
- );
- this.pre_cantidades('.cant_fijas');
- control_submit.no_enter('.noenter');
- }
- else {
- mensajes.error('VERIFIQUE EL CODIGO DEL PRODUCTO');
- this.pro_repopular();
- }
- }
- };
- var esperar = {
- animated: function(bar){
- var progress = setInterval(function() {
- if (bar.width()==400) {
- clearInterval(progress);
- $('.progress').removeClass('active');
- } else {
- bar.width(bar.width()+40);
- }
- bar.text(bar.width()/4 + "%");
- }, 800);
- return progress;
- },
- definir: function(){
- bar ='<br><br><br><br><br><br><div class="container" style="text-align: center"; margin-top: 200px;>'
- +'<div class="progress progress-striped active">'
- +'<div class="bar" style="width: 0%;"></div>'
- +'</div>'
- +'</div>'
- return bar;
- },
- procesando: function(){
- bar = $('<div class="modal hide pro_dia" data-backdrop="static" data-keyboard="false">'
- +'<div class="modal-header">'
- +' <h1>PROCESANDO...</h1>'
- +'</div>'
- +'<div class="modal-body">'
- + '<div class="progress progress-striped active">'
- + '<div class="bar" style="width: 100%;"></div>'
- + '</div>'
- +'</div>'
- +'</div>');
- return bar;
- },
- mostrar_dialogo: function(){
- bar = this.procesando();
- bar.modal();
- },
- cerrar_dialogo: function(){
- $('.pro_dia').modal('hide');
- }
- }
- var mensajes = {
- ini_aba: function() {
- Messenger.options = {
- extraClasses: 'messenger-fixed messenger-on-bottom',
- theme: 'future'
- }
- },
- ini_arri: function() {
- Messenger.options = {
- extraClasses: 'messenger-fixed messenger-on-top',
- theme: 'future'
- }
- },
- error: function(mensaje){
- Messenger().post({
- message: mensaje,
- type: 'error',
- showCloseButton: true
- });
- },
- exitos: function(mensaje) {
- Messenger().post(mensaje);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement