mivita/resources/assets/vendor/libs/bootstrap-table/extensions/click-edit-row/click-edit-row.js
2018-10-29 09:39:31 +01:00

1 line
No EOL
3.5 KiB
JavaScript
Executable file

!function(t,e){var n=function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=357)}({356:function(t,e){!function(t){"use strict";function e(e,n){var i=[],o=e;if(o.editing){o.editing=!1,o.columns.forEach(function(e,o){if(e.editable)switch(e.editable){case"input":var a=t('<div class="editable-input col-md-12 col-sm-12 col-xs-12" style="position: relative;"/>');i.push(n.find("td").eq(e.fieldIndex).text()),a.append(t('<input type="text" class="form-control input-sm"/>')),a.append(t('<span class="clear"><i class="fa fa-times-circle-o" aria-hidden="true"></i></span>')),n.find("td").eq(e.fieldIndex).text("").append(a);break;case"select":var l=t('<select id="'+e.field+'">'),d=t.selectArray[e.field];n.find("td").eq(e.fieldIndex).text("").append(l),function(e,n){var i=t("<option />");n?t(n).each(function(t,n){i.clone().text(n.idxNum+" "+n.name).val(n.idxNum).appendTo(e)}):console.log("Please setup options first!!")}(t("#"+e.field),d);break;case"textarea":break;default:console.log(e.fieldIndex+" "+e.editable)}},e);for(var a=0,l=i.length;a<l;a++)n.find('input[type="text"]').eq(a).val(i[a]);n.find("td").last().append('<div id="tooling" class="editable-buttons"/>'),t(".clear").on("click",function(){t(this).parent().find("input").val("")}),t('<button type="button" class="btn btn-primary btn-sm editable-submit"><i class="glyphicon glyphicon-ok"></i></button>').on("click",function(){return i=[],n.find("td").find('input[type="text"]').each(function(e,n){i.push(t(n).eq(0).val())}),n.find("select").each(function(e,n){i.push(t("#"+n.id+" option:selected").val())}),t("#table").bootstrapTable("updateRow",{index:o.$data.thId,row:{noOld:i[0],area:n.find("select").eq(0).children(":selected").text(),town:n.find("select").eq(1).children(":selected").text(),address:i[1]}}),t("#tooling").remove(),o.editing=!0,!1}).appendTo("#tooling"),t('<button type="button" class="btn btn-default btn-sm editable-cancel"><i class="glyphicon glyphicon-remove"></i></button>').on("click",function(){return t("#table").bootstrapTable("updateRow",{index:o.$data.thId,row:{}}),t("#tooling").remove(),o.editing=!0,!1}).appendTo("#tooling")}}t.extend(t.fn.bootstrapTable.defaults,{clickEdit:!1});var n=t.fn.bootstrapTable.Constructor,i=n.prototype.initTable,o=n.prototype.initBody;n.prototype.initTable=function(){this.$data={},i.apply(this,Array.prototype.slice.apply(arguments)),this.options.clickEdit},n.prototype.initBody=function(){if(o.apply(this,Array.prototype.slice.apply(arguments)),this.options.clickEdit){var t=this.$tableBody.find("table");this.editing=!0,t.on("click-row.bs.table",function(t,n,i,o){"no"!==o&&(this.$data.thId=i.data().index,this.$data.itemid=i.data().uniqueid,this.$data.divi=parseInt(n.area),this.$data.town=parseInt(n.town),e(this,i))}.bind(this))}}}(jQuery)},357:function(t,e,n){n(356)}});if("object"==typeof n){var i=["object"==typeof module&&"object"==typeof module.exports?module.exports:null,"undefined"!=typeof window?window:null,t&&t!==window?t:null];for(var o in n)i[0]&&(i[0][o]=n[o]),i[1]&&"__esModule"!==o&&(i[1][o]=n[o]),i[2]&&(i[2][o]=n[o])}}(this);