isobit-ui 0.0.195 → 0.0.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +693 -692
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * isobit-ui v0.0.195
2
+ * isobit-ui v0.0.198
3
3
  * (c) Erik Alarcon Pinedo
4
4
  * Released under the MIT License.
5
5
  */
@@ -5169,834 +5169,835 @@ _.MsgBox = function MsgBox(m, cb, b) {
5169
5169
  };
5170
5170
 
5171
5171
  window._.baseURL = window.axios.defaults.baseURL;
5172
- var defs = {
5173
- watch: {
5174
- $route: function $route(v) {
5175
- this.changeRoute(v);
5176
- }
5177
- },
5178
- computed: {
5179
- online: function online() {
5180
- return this.app.networkStatus.connected;
5181
- },
5182
- user: function user() {
5183
- return window.app.session;
5184
- },
5185
- app: function app() {
5186
- return window.app;
5187
- },
5188
- perms: function perms() {
5189
- return this.user.perms;
5190
- },
5191
- rowSelectedCount: function rowSelectedCount() {
5192
- var me = this;
5193
- console.log(me.$children);
5194
- if (!me.$children[0]) return 0;
5195
- var t = me.$children[0].$children[0];
5196
- return t ? t.selected.length : 0;
5197
- },
5198
- baseURL: function baseURL() {
5199
- return window._.baseURL;
5200
- },
5201
- session: function session() {
5202
- return window.app.session;
5203
- }
5204
- },
5205
- data: function data() {
5206
- var me = this;
5207
- return {
5208
- filters: {},
5209
- ui: me,
5210
- //rowSelectedCount: 0,
5211
- row: {}
5212
- };
5213
- },
5214
- updated: function updated() {// console.log(this);
5215
- },
5216
- mounted: function mounted() {
5217
- var me = this;
5218
5172
 
5219
- var vueid = _.id(); //error cuando se carga un mapa con v-panel el mapa de turismo es ejemplo
5173
+ function isObject(item) {
5174
+ return item && _typeof(item) === 'object' && !Array.isArray(item);
5175
+ }
5220
5176
 
5177
+ Vue.mergeDeep = function () {
5178
+ var target = arguments[0];
5179
+ var sources = [];
5221
5180
 
5222
- if (me.$el && me.$el.setAttribute) {
5223
- me.$el.setAttribute("vueid", vueid);
5224
- }
5181
+ for (var i = 1; i < arguments.length; i++) {
5182
+ sources.push(arguments[i]);
5183
+ } //Vue.mergeDeep = function(target, ...sources) {
5225
5184
 
5226
- _.varMap[vueid] = me;
5227
- me.ddd(me.$root);
5228
- },
5229
- methods: {
5230
- MsgBox: _.MsgBox,
5231
- changeRoute: function changeRoute() {
5232
- /*console.log(v)*/
5233
- },
5234
- pad: Vue.pad,
5235
- key: function key() {
5236
- return Math.random();
5237
- },
5238
- submitFile: function submitFile(f, name, cb) {
5239
- var formData = new FormData();
5240
- name = name ? name : f.name.replace(/[^\w\s.]/gi, '');
5241
- formData.append('filename', name);
5242
- formData.append('file', f, name);
5243
- axios.post('/api/file/upload', formData, {
5244
- headers: {
5245
- 'Content-Type': 'multipart/form-data',
5246
- filename: name
5185
+
5186
+ if (!sources.length) return target; //Se obtiene el primer elemento de source
5187
+
5188
+ var source = sources.shift(),
5189
+ nv; //const source = sources.shift();
5190
+
5191
+ if (isObject(target) && isObject(source)) {
5192
+ for (var key in source) {
5193
+ //for (const key in source) {
5194
+ if (isObject(source[key])) {
5195
+ console.log(key);
5196
+ console.log(source[key]);
5197
+ console.log(_typeof(source[key]));
5198
+
5199
+ if (!target[key]) {
5200
+ nv = {};
5201
+ nv[key] = {};
5202
+ Object.assign(target, nv);
5247
5203
  }
5248
- }).then(function (r) {
5249
- cb(r.data);
5250
- })["catch"](function () {
5251
- console.log('FAILURE!!');
5252
- });
5253
- },
5254
- go: function go(e) {
5255
- window.o(e);
5256
- },
5257
- ddd: function ddd()
5258
- /*o*/
5259
- {// for(var i=0;i<o.$children.length;i++){
5260
- // var child=o.$children[i];
5261
- // console.log(child);
5262
- // if (child.$vnode.tag && child.$vnode.tag.includes("v-table")) {
5263
- // //child.setColumns(columns);
5264
- // }else{
5265
- // this.ddd(child);
5266
- // }
5267
- // }
5268
- },
5269
- rowCreated: function rowCreated(r) {
5270
- this.row = r;
5271
- },
5272
- getSelected: function getSelected() {
5273
- var me = this;
5274
- var t = me.$children[0].$children[0];
5275
- var s = [];
5276
5204
 
5277
- for (var i = 0; i < t.selected.length; i++) {
5278
- s.push(t.data[t.selected[i]]);
5205
+ Vue.mergeDeep(target[key], source[key]);
5206
+ } else {
5207
+ nv = {};
5208
+ nv[key] = source[key];
5209
+ Object.assign(target, nv); //Object.assign(target, { [key]: source[key] });
5279
5210
  }
5211
+ }
5212
+ }
5280
5213
 
5281
- return s;
5282
- },
5283
- getRowSelectedCount: function getRowSelectedCount() {
5284
- var me = this;
5285
- var t = me.$children[0].$children[0];
5286
- return t ? t.selected.length : 0;
5287
- },
5288
- create: function create() {
5289
- var me = this;
5290
- var action = me.$children[0].action;
5291
- if (!action) action = window.location.pathname;
5292
- action = _.processURL(action);
5214
+ var args = [];
5215
+ args.push(target);
5216
+ return Vue.mergeDeep.apply(null, args); //return mergeDeep(target, ...sources);
5217
+ };
5293
5218
 
5294
- if (window.o) {
5295
- window.o(action + '/create');
5296
- } else {
5297
- instance.get(_.currentPath = (action + '/create').replace(/([^:]\/)\/+/g, "$1") + '?modal').then(_.open)["catch"](me.error);
5219
+ window.ui = _.ui = function (cfg) {
5220
+ var defs = {
5221
+ watch: {
5222
+ $route: function $route(v) {
5223
+ this.changeRoute(v);
5298
5224
  }
5299
5225
  },
5300
- edit: function edit() {
5301
- var me = this;
5302
- var f = me.$children[0];
5303
- var action = f.action;
5304
- if (!action) action = window.location.pathname;
5305
- var t = me.$children[0].$children[0];
5306
- var id = t.data[t.selected[0]][t.rowKey];
5307
- if (t.data[t.selected[0]].tmpId) id = -t.data[t.selected[0]].tmpId;
5308
- if (me.getSelectedId) id = me.getSelectedId(t.data[t.selected[0]]);
5309
-
5310
- if (window.o) {
5311
- window.o(action + '/' + id + '/edit');
5312
- } else {
5313
- axios.get((_.currentPath = (action + '/' + id + '/edit').replace(/([^:]\/)\/+/g, "$1")) + '?modal').then(me.open)["catch"](me.error);
5226
+ computed: {
5227
+ online: function online() {
5228
+ return this.app.networkStatus.connected;
5229
+ },
5230
+ user: function user() {
5231
+ return window.app.session;
5232
+ },
5233
+ app: function app() {
5234
+ return window.app;
5235
+ },
5236
+ perms: function perms() {
5237
+ return this.user.perms;
5238
+ },
5239
+ rowSelectedCount: function rowSelectedCount() {
5240
+ var me = this;
5241
+ console.log(me.$children);
5242
+ if (!me.$children[0]) return 0;
5243
+ var t = me.$children[0].$children[0];
5244
+ return t ? t.selected.length : 0;
5245
+ },
5246
+ baseURL: function baseURL() {
5247
+ return window._.baseURL;
5248
+ },
5249
+ session: function session() {
5250
+ return window.app.session;
5314
5251
  }
5315
5252
  },
5316
- get: function get(part) {
5253
+ data: function data() {
5317
5254
  var me = this;
5318
- var p = me.$el; //Se debe buscar si abajo esta el form
5319
-
5320
- var f = p.querySelector("form");
5321
- var action = f.action; //console.log(me.apiLink(action) + '/' + part);
5322
-
5323
- window.location.href = me.apiLink(action) + '/' + part;
5255
+ return {
5256
+ filters: {},
5257
+ ui: me,
5258
+ //rowSelectedCount: 0,
5259
+ row: {}
5260
+ };
5324
5261
  },
5325
- error: function error(e) {
5326
- //console.log(e);
5327
- alert(e); //this.open({data:''+e});
5262
+ updated: function updated() {// console.log(this);
5328
5263
  },
5329
- destroy: function destroy() {
5264
+ mounted: function mounted() {
5330
5265
  var me = this;
5331
- var f = me.$children[0];
5332
- f.action;
5333
- var t = me.$children[0].$children[0]; //console.log(t);
5334
-
5335
- var key = t.$attrs.rowkey;
5336
- if (!key) key = t.rowKey;
5337
- console.log(t.selected);
5338
- var dat = t.data[t.selected[0]];
5339
- console.log(dat);
5340
-
5341
- if (dat.tmpId) {
5342
- MsgBox('Esta seguro que desea eliminar los registros temporales seleccionados ?', function (r) {
5343
- if (r == 0) {
5344
- var c = 0,
5345
- db = window._.db;
5346
- var objectStore = db.transaction([t.storage], "readwrite").objectStore(t.storage);
5347
- var ele = [];
5348
-
5349
- for (var k = t.selected.length - 1; k >= 0; k--) {
5350
- dat = t.data[t.selected[k]];
5351
-
5352
- if (dat.tmpId) {
5353
- ele.push(dat);
5354
- objectStore["delete"](dat.tmpId);
5355
- c++;
5356
- t.data.splice(t.selected[k], 1);
5357
- }
5358
- }
5359
5266
 
5360
- if (c) MsgBox(c + ' Registros eliminado');
5361
- t.rowSelect(null, -1);
5362
- t.selected = [];
5363
- me.$emit('destroyed', ele);
5364
- }
5365
- }, ['SI', 'NO']);
5366
- } else {
5367
- if (!key) return alert('Table don`t have defined attribute \'rowkey\'');
5368
- var id = dat[key];
5369
- MsgBox('Esta seguro que desea eliminar el registro seleccionado?', function (r) {
5370
- if (r == 0) {
5371
- axios["delete"](t.src + '/' + id).then(function () {
5372
- MsgBox('Registro eliminado');
5373
- var id = dat.id;
5374
-
5375
- for (var i = dat.length - 1; i >= 0; i--) {
5376
- if (dat[i][key] == id) {
5377
- dat.splice(i, 1);
5378
- }
5379
- }
5380
- })["catch"](me.error);
5381
- }
5267
+ var vueid = _.id(); //error cuando se carga un mapa con v-panel el mapa de turismo es ejemplo
5268
+
5382
5269
 
5383
- t.rowSelect(null, -1);
5384
- }, ['SI', 'NO']);
5270
+ if (me.$el && me.$el.setAttribute) {
5271
+ me.$el.setAttribute("vueid", vueid);
5385
5272
  }
5273
+
5274
+ _.varMap[vueid] = me;
5275
+ me.ddd(me.$root);
5386
5276
  },
5387
- apiLink: function apiLink(str) {
5388
- return str.replace(_.contextPath, _.contextPath + '/api');
5389
- },
5390
- open: function open(response, path, o) {
5391
- var me = this;
5277
+ methods: {
5278
+ MsgBox: _.MsgBox,
5279
+ changeRoute: function changeRoute() {
5280
+ /*console.log(v)*/
5281
+ },
5282
+ pad: Vue.pad,
5283
+ key: function key() {
5284
+ return Math.random();
5285
+ },
5286
+ submitFile: function submitFile(f, name, cb) {
5287
+ var formData = new FormData();
5288
+ name = name ? name : f.name.replace(/[^\w\s.]/gi, '');
5289
+ formData.append('filename', name);
5290
+ formData.append('file', f, name);
5291
+ axios.post('/api/file/upload', formData, {
5292
+ headers: {
5293
+ 'Content-Type': 'multipart/form-data',
5294
+ filename: name
5295
+ }
5296
+ }).then(function (r) {
5297
+ cb(r.data);
5298
+ })["catch"](function () {
5299
+ console.log('FAILURE!!');
5300
+ });
5301
+ },
5302
+ go: function go(e) {
5303
+ window.o(e);
5304
+ },
5305
+ ddd: function ddd()
5306
+ /*o*/
5307
+ {// for(var i=0;i<o.$children.length;i++){
5308
+ // var child=o.$children[i];
5309
+ // console.log(child);
5310
+ // if (child.$vnode.tag && child.$vnode.tag.includes("v-table")) {
5311
+ // //child.setColumns(columns);
5312
+ // }else{
5313
+ // this.ddd(child);
5314
+ // }
5315
+ // }
5316
+ },
5317
+ rowCreated: function rowCreated(r) {
5318
+ this.row = r;
5319
+ },
5320
+ getSelected: function getSelected() {
5321
+ var me = this;
5322
+ var t = me.$children[0].$children[0];
5323
+ var s = [];
5392
5324
 
5393
- if (response === 'GET') {
5394
- _.currentPath = path + '/' + o; // window.history.pushState(_.currentPath, t, '{}');
5325
+ for (var i = 0; i < t.selected.length; i++) {
5326
+ s.push(t.data[t.selected[i]]);
5327
+ }
5395
5328
 
5396
- axios.get((_.currentPath + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(me.open)["catch"](me.error);
5397
- return;
5398
- } else if (typeof response == 'string') {
5399
- if (path === true) window.app.$router.replace(_.currentPath = response);else window.app.$router.push(_.currentPath = response);
5400
- return;
5401
- }
5329
+ return s;
5330
+ },
5331
+ getRowSelectedCount: function getRowSelectedCount() {
5332
+ var me = this;
5333
+ var t = me.$children[0].$children[0];
5334
+ return t ? t.selected.length : 0;
5335
+ },
5336
+ create: function create() {
5337
+ var me = this;
5338
+ var action = me.$children[0].action;
5339
+ if (!action) action = window.location.pathname;
5340
+ action = _.processURL(action);
5341
+
5342
+ if (window.o) {
5343
+ window.o(action + '/create');
5344
+ } else {
5345
+ instance.get(_.currentPath = (action + '/create').replace(/([^:]\/)\/+/g, "$1") + '?modal').then(_.open)["catch"](me.error);
5346
+ }
5347
+ },
5348
+ edit: function edit() {
5349
+ var me = this;
5350
+ var f = me.$children[0];
5351
+ var action = f.action;
5352
+ if (!action) action = window.location.pathname;
5353
+ var t = me.$children[0].$children[0];
5354
+ var id = t.data[t.selected[0]][t.rowKey];
5355
+ if (t.data[t.selected[0]].tmpId) id = -t.data[t.selected[0]].tmpId;
5356
+ if (me.getSelectedId) id = me.getSelectedId(t.data[t.selected[0]]);
5402
5357
 
5403
- var overlay = document.createElement("div");
5404
- overlay.classList.add("v-overlay");
5405
- overlay.style.padding = "40px";
5406
- document.body.appendChild(overlay);
5407
- var dialog = document.createElement("div");
5408
- dialog.classList.add("v-dialog");
5409
- dialog.innerHTML = response.data;
5410
- var s = dialog.getElementsByTagName('script'); //console.log('patttt=' + _.currentPath);
5358
+ if (window.o) {
5359
+ window.o(action + '/' + id + '/edit');
5360
+ } else {
5361
+ axios.get((_.currentPath = (action + '/' + id + '/edit').replace(/([^:]\/)\/+/g, "$1")) + '?modal').then(me.open)["catch"](me.error);
5362
+ }
5363
+ },
5364
+ get: function get(part) {
5365
+ var me = this;
5366
+ var p = me.$el; //Se debe buscar si abajo esta el form
5411
5367
 
5412
- dialog.setAttribute("path", _.currentPath);
5368
+ var f = p.querySelector("form");
5369
+ var action = f.action; //console.log(me.apiLink(action) + '/' + part);
5413
5370
 
5414
- var nid = _.id();
5371
+ window.location.href = me.apiLink(action) + '/' + part;
5372
+ },
5373
+ error: function error(e) {
5374
+ //console.log(e);
5375
+ alert(e); //this.open({data:''+e});
5376
+ },
5377
+ destroy: function destroy() {
5378
+ var me = this;
5379
+ var f = me.$children[0];
5380
+ f.action;
5381
+ var t = me.$children[0].$children[0]; //console.log(t);
5382
+
5383
+ var key = t.$attrs.rowkey;
5384
+ if (!key) key = t.rowKey;
5385
+ console.log(t.selected);
5386
+ var dat = t.data[t.selected[0]];
5387
+ console.log(dat);
5388
+
5389
+ if (dat.tmpId) {
5390
+ MsgBox('Esta seguro que desea eliminar los registros temporales seleccionados ?', function (r) {
5391
+ if (r == 0) {
5392
+ var c = 0,
5393
+ db = window._.db;
5394
+ var objectStore = db.transaction([t.storage], "readwrite").objectStore(t.storage);
5395
+ var ele = [];
5396
+
5397
+ for (var k = t.selected.length - 1; k >= 0; k--) {
5398
+ dat = t.data[t.selected[k]];
5399
+
5400
+ if (dat.tmpId) {
5401
+ ele.push(dat);
5402
+ objectStore["delete"](dat.tmpId);
5403
+ c++;
5404
+ t.data.splice(t.selected[k], 1);
5405
+ }
5406
+ }
5415
5407
 
5416
- dialog.setAttribute("callback", nid);
5417
- overlay.appendChild(dialog);
5408
+ if (c) MsgBox(c + ' Registros eliminado');
5409
+ t.rowSelect(null, -1);
5410
+ t.selected = [];
5411
+ me.$emit('destroyed', ele);
5412
+ }
5413
+ }, ['SI', 'NO']);
5414
+ } else {
5415
+ if (!key) return alert('Table don`t have defined attribute \'rowkey\'');
5416
+ var id = dat[key];
5417
+ MsgBox('Esta seguro que desea eliminar el registro seleccionado?', function (r) {
5418
+ if (r == 0) {
5419
+ axios["delete"](t.src + '/' + id).then(function () {
5420
+ MsgBox('Registro eliminado');
5421
+ var id = dat.id;
5422
+
5423
+ for (var i = dat.length - 1; i >= 0; i--) {
5424
+ if (dat[i][key] == id) {
5425
+ dat.splice(i, 1);
5426
+ }
5427
+ }
5428
+ })["catch"](me.error);
5429
+ }
5418
5430
 
5419
- for (var i = 0; s.length > i; i++) {
5420
- eval(s[i].innerHTML);
5421
- }
5431
+ t.rowSelect(null, -1);
5432
+ }, ['SI', 'NO']);
5433
+ }
5434
+ },
5435
+ apiLink: function apiLink(str) {
5436
+ return str.replace(_.contextPath, _.contextPath + '/api');
5437
+ },
5438
+ open: function open(response, path, o) {
5439
+ var me = this;
5422
5440
 
5423
- overlay.style.visibility = "unset";
5424
- overlay.style.opacity = "unset";
5425
- overlay.style.overflow = "auto";
5426
- dialog.style.margin = "0 auto";
5427
- dialog.style.position = "unset";
5441
+ if (response === 'GET') {
5442
+ _.currentPath = path + '/' + o; // window.history.pushState(_.currentPath, t, '{}');
5428
5443
 
5429
- _.storeFunction[nid] = function (o) {
5430
- if (o === true) me.refresh();
5431
- };
5444
+ axios.get((_.currentPath + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(me.open)["catch"](me.error);
5445
+ return;
5446
+ } else if (typeof response == 'string') {
5447
+ if (path === true) window.app.$router.replace(_.currentPath = response);else window.app.$router.push(_.currentPath = response);
5448
+ return;
5449
+ }
5450
+
5451
+ var overlay = document.createElement("div");
5452
+ overlay.classList.add("v-overlay");
5453
+ overlay.style.padding = "40px";
5454
+ document.body.appendChild(overlay);
5455
+ var dialog = document.createElement("div");
5456
+ dialog.classList.add("v-dialog");
5457
+ dialog.innerHTML = response.data;
5458
+ var s = dialog.getElementsByTagName('script'); //console.log('patttt=' + _.currentPath);
5432
5459
 
5433
- var resize = function resize() {
5434
- dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
5460
+ dialog.setAttribute("path", _.currentPath);
5435
5461
 
5436
- if (window.innerWidth < 600) {
5437
- var dc = dialog.querySelector('.ui-dialog-content'); //console.log(dc);
5462
+ var nid = _.id();
5438
5463
 
5439
- var h = dialog.querySelector('.ui-panel-titlebar'); //console.log(h.clientHeight);
5464
+ dialog.setAttribute("callback", nid);
5465
+ overlay.appendChild(dialog);
5440
5466
 
5441
- var ih = window.innerHeight - 94 - h.clientHeight;
5442
- dc.style.height = ih + "px";
5467
+ for (var i = 0; s.length > i; i++) {
5468
+ eval(s[i].innerHTML);
5443
5469
  }
5444
- };
5445
5470
 
5446
- window.addEventListener('resize', resize);
5447
- var h = dialog.querySelector('.ui-panel-titlebar');
5448
- var acl = h.querySelector('.ui-js-close');
5471
+ overlay.style.visibility = "unset";
5472
+ overlay.style.opacity = "unset";
5473
+ overlay.style.overflow = "auto";
5474
+ dialog.style.margin = "0 auto";
5475
+ dialog.style.position = "unset";
5449
5476
 
5450
- window.onkeyup = function (event) {
5451
- if (event.keyCode == 27) {
5452
- dialog.style.display = "none";
5453
- overlay.style.display = "none";
5477
+ _.storeFunction[nid] = function (o) {
5478
+ if (o === true) me.refresh();
5479
+ };
5454
5480
 
5455
- _.RSZ();
5456
- }
5457
- };
5481
+ var resize = function resize() {
5482
+ dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
5458
5483
 
5459
- if (!acl) {
5460
- var span = document.createElement("i");
5461
- span.style.top = "6px";
5462
- span.style.right = "6px";
5463
- h.style.position = "relative";
5464
- span.style.position = "absolute";
5465
- span.style.color = "white";
5466
- span.className = "fa fa-window-close v-dialog-close";
5467
- acl = document.createElement("a");
5468
- acl.className = "ui-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all";
5469
- acl.appendChild(span);
5470
- h.appendChild(acl);
5471
- acl.addEventListener("click", function () {
5472
- dialog.style.display = "none";
5473
- overlay.style.display = "none";
5474
- resize();
5475
- });
5476
- }
5484
+ if (window.innerWidth < 600) {
5485
+ var dc = dialog.querySelector('.ui-dialog-content'); //console.log(dc);
5477
5486
 
5478
- resize();
5479
- },
5480
- close: function close(ok) {
5481
- var dlg = this.$el.parentElement;
5487
+ var h = dialog.querySelector('.ui-panel-titlebar'); //console.log(h.clientHeight);
5482
5488
 
5483
- if (window.app) {
5484
- window.app.$router.back();
5485
- } else {
5486
- var mask = dlg.parentElement;
5487
- dlg.style.display = "none"; //console.log(mask);
5488
- //Solo se debe ocultaqr si es la marcara del dlg
5489
+ var ih = window.innerHeight - 94 - h.clientHeight;
5490
+ dc.style.height = ih + "px";
5491
+ }
5492
+ };
5489
5493
 
5490
- if ((' ' + mask.className + ' ').indexOf(' v-overlay ') > -1) mask.style.display = "none";
5491
- resize();
5492
- }
5494
+ window.addEventListener('resize', resize);
5495
+ var h = dialog.querySelector('.ui-panel-titlebar');
5496
+ var acl = h.querySelector('.ui-js-close');
5493
5497
 
5494
- var cb = _.storeFunction[dlg.getAttribute("callback")];
5498
+ window.onkeyup = function (event) {
5499
+ if (event.keyCode == 27) {
5500
+ dialog.style.display = "none";
5501
+ overlay.style.display = "none";
5495
5502
 
5496
- if (cb) cb(ok); //si history esta activo
5497
- //history.back();
5498
- },
5499
- refresh: function refresh() {
5500
- //Para que funcione se debe tener el listado respetando la estructura
5501
- var me = this;
5502
- var t = me.$children[0].$children[0];
5503
- t.load();
5504
- },
5505
- getStoredList: function getStoredList(storage, tt) {
5506
- try {
5507
- if (window.idb) {
5508
- var p = new Promise(function (resolve) {
5509
- var t = tt ? window._.db.transaction(storage, tt) : window._.db.transaction(storage),
5510
- objectStore = t.objectStore(storage); //,d=[];
5503
+ _.RSZ();
5504
+ }
5505
+ };
5511
5506
 
5512
- var r = objectStore.getAll();
5507
+ if (!acl) {
5508
+ var span = document.createElement("i");
5509
+ span.style.top = "6px";
5510
+ span.style.right = "6px";
5511
+ h.style.position = "relative";
5512
+ span.style.position = "absolute";
5513
+ span.style.color = "white";
5514
+ span.className = "fa fa-window-close v-dialog-close";
5515
+ acl = document.createElement("a");
5516
+ acl.className = "ui-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all";
5517
+ acl.appendChild(span);
5518
+ h.appendChild(acl);
5519
+ acl.addEventListener("click", function () {
5520
+ dialog.style.display = "none";
5521
+ overlay.style.display = "none";
5522
+ resize();
5523
+ });
5524
+ }
5513
5525
 
5514
- r.onsuccess = function () {
5515
- resolve(r.result, t);
5516
- }; //t.onerror = event => reject(event.target.error);
5526
+ resize();
5527
+ },
5528
+ close: function close(ok) {
5529
+ var dlg = this.$el.parentElement;
5517
5530
 
5518
- });
5519
- return _await(p);
5531
+ if (window.app) {
5532
+ window.app.$router.back();
5520
5533
  } else {
5521
- var vvv = localStorage.getItem(storage);
5522
-
5523
- try {
5524
- if (vvv) vvv = JSON.parse(vvv);
5525
- } catch (e) {
5526
- MsgBox(e);
5527
- vvv = null;
5528
- }
5534
+ var mask = dlg.parentElement;
5535
+ dlg.style.display = "none"; //console.log(mask);
5536
+ //Solo se debe ocultaqr si es la marcara del dlg
5529
5537
 
5530
- return vvv;
5538
+ if ((' ' + mask.className + ' ').indexOf(' v-overlay ') > -1) mask.style.display = "none";
5539
+ resize();
5531
5540
  }
5532
- } catch (e) {
5533
- return Promise.reject(e);
5534
- }
5535
- },
5536
- removeStored: function removeStored(storage) {
5537
- if (window.idb) {
5538
- var db = window._.db,
5539
- objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5540
- var objectStoreRequest = objectStore.clear();
5541
5541
 
5542
- objectStoreRequest.onerror = function () {
5543
- MsgBox('Error al eliminar data temporal');
5544
- };
5545
- } else {
5546
- localStorage.removeItem(storage);
5547
- }
5548
- },
5549
- setStoredList: function setStoredList(storage, data) {
5550
- try {
5551
- var db, objectStore;
5542
+ var cb = _.storeFunction[dlg.getAttribute("callback")];
5552
5543
 
5553
- if (window.idb) {
5554
- db = window._.db;
5555
- objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5556
- var objectStoreRequest = objectStore.clear();
5544
+ if (cb) cb(ok); //si history esta activo
5545
+ //history.back();
5546
+ },
5547
+ refresh: function refresh() {
5548
+ //Para que funcione se debe tener el listado respetando la estructura
5549
+ var me = this;
5550
+ var t = me.$children[0].$children[0];
5551
+ t.load();
5552
+ },
5553
+ getStoredList: function getStoredList(storage, tt) {
5554
+ try {
5555
+ if (window.idb) {
5556
+ var p = new Promise(function (resolve) {
5557
+ var t = tt ? window._.db.transaction(storage, tt) : window._.db.transaction(storage),
5558
+ objectStore = t.objectStore(storage); //,d=[];
5557
5559
 
5558
- objectStoreRequest.onsuccess = function () {
5559
- for (var i in data) {
5560
- var request = objectStore.add(data[i]);
5560
+ var r = objectStore.getAll();
5561
5561
 
5562
- request.onerror = function (event) {
5563
- console.log(event);
5564
- };
5562
+ r.onsuccess = function () {
5563
+ resolve(r.result, t);
5564
+ }; //t.onerror = event => reject(event.target.error);
5565
+
5566
+ });
5567
+ return _await(p);
5568
+ } else {
5569
+ var vvv = localStorage.getItem(storage);
5570
+
5571
+ try {
5572
+ if (vvv) vvv = JSON.parse(vvv);
5573
+ } catch (e) {
5574
+ MsgBox(e);
5575
+ vvv = null;
5565
5576
  }
5577
+
5578
+ return vvv;
5579
+ }
5580
+ } catch (e) {
5581
+ return Promise.reject(e);
5582
+ }
5583
+ },
5584
+ removeStored: function removeStored(storage) {
5585
+ if (window.idb) {
5586
+ var db = window._.db,
5587
+ objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5588
+ var objectStoreRequest = objectStore.clear();
5589
+
5590
+ objectStoreRequest.onerror = function () {
5591
+ MsgBox('Error al eliminar data temporal');
5566
5592
  };
5567
5593
  } else {
5568
- localStorage.setItem(storage, JSON.stringify(data));
5594
+ localStorage.removeItem(storage);
5569
5595
  }
5596
+ },
5597
+ setStoredList: function setStoredList(storage, data) {
5598
+ try {
5599
+ var db, objectStore;
5570
5600
 
5571
- return _await();
5572
- } catch (e) {
5573
- return Promise.reject(e);
5574
- }
5575
- },
5576
- getStoreObject: function getStoreObject(storage, id) {
5577
- var db = window._.db,
5578
- objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5579
- return objectStore.get(id);
5580
- },
5581
- sync: function sync() {
5582
- try {
5583
- var _this2 = this;
5601
+ if (window.idb) {
5602
+ db = window._.db;
5603
+ objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5604
+ var objectStoreRequest = objectStore.clear();
5584
5605
 
5585
- var me = _this2;
5586
- var p = me.$el;
5587
- var f = p.querySelector("form");
5588
- var action = f.getAttribute('action'); //console.log('Action='+action);
5606
+ objectStoreRequest.onsuccess = function () {
5607
+ for (var i in data) {
5608
+ var request = objectStore.add(data[i]);
5589
5609
 
5590
- if (!action) {
5591
- action = me.$el.parentNode.getAttribute('path'); //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
5610
+ request.onerror = function (event) {
5611
+ console.log(event);
5612
+ };
5613
+ }
5614
+ };
5615
+ } else {
5616
+ localStorage.setItem(storage, JSON.stringify(data));
5617
+ }
5592
5618
 
5593
- var tc = action.split('/');
5594
- if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
5595
- action = me.apiLink(tc.join('/'));
5619
+ return _await();
5620
+ } catch (e) {
5621
+ return Promise.reject(e);
5596
5622
  }
5623
+ },
5624
+ getStoreObject: function getStoreObject(storage, id) {
5625
+ var db = window._.db,
5626
+ objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5627
+ return objectStore.get(id);
5628
+ },
5629
+ sync: function sync() {
5630
+ try {
5631
+ var _this2 = this;
5597
5632
 
5598
- var t = me.$children[0].$children[0];
5599
- action = t.src; //debe recorrerse toda los registros seleccionados
5600
- //ponerlos gris
5601
-
5602
- return _await(me.getStoredList(t.storage), function (dats) {
5603
- var sel = t.selected;
5604
- var sel2 = [];
5605
- var sel3 = [];
5606
-
5607
- for (var i = 0; i < sel.length; i++) {
5608
- //se recupra
5609
- var item = t.data[sel[i]];
5610
-
5611
- if (item.tmpId && !item.tmpSynchronized) {
5612
- for (var j = 0; j < dats.length; j++) {
5613
- if (dats[j].tmpId == item.tmpId) {
5614
- var o = JSON.clone(dats[j]);
5615
- delete o.tmpSynchronized;
5616
- sel3.push(o);
5617
- sel2.push(j);
5633
+ var me = _this2;
5634
+ var p = me.$el;
5635
+ var f = p.querySelector("form");
5636
+ var action = f.getAttribute('action'); //console.log('Action='+action);
5637
+
5638
+ if (!action) {
5639
+ action = me.$el.parentNode.getAttribute('path'); //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
5640
+
5641
+ var tc = action.split('/');
5642
+ if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
5643
+ action = me.apiLink(tc.join('/'));
5644
+ }
5645
+
5646
+ var t = me.$children[0].$children[0];
5647
+ action = t.src; //debe recorrerse toda los registros seleccionados
5648
+ //ponerlos gris
5649
+
5650
+ return _await(me.getStoredList(t.storage), function (dats) {
5651
+ var sel = t.selected;
5652
+ var sel2 = [];
5653
+ var sel3 = [];
5654
+
5655
+ for (var i = 0; i < sel.length; i++) {
5656
+ //se recupra
5657
+ var item = t.data[sel[i]];
5658
+
5659
+ if (item.tmpId && !item.tmpSynchronized) {
5660
+ for (var j = 0; j < dats.length; j++) {
5661
+ if (dats[j].tmpId == item.tmpId) {
5662
+ var o = JSON.clone(dats[j]);
5663
+ delete o.tmpSynchronized;
5664
+ sel3.push(o);
5665
+ sel2.push(j);
5666
+ }
5618
5667
  }
5619
5668
  }
5620
- }
5621
- } //se envia solo los selccionados
5669
+ } //se envia solo los selccionados
5622
5670
 
5623
5671
 
5624
- if (sel2.length > 0) {
5625
- axios.post(action + '/bulk', sel3).then(function (r) {
5626
- var d = r.data;
5627
- console.log(d);
5672
+ if (sel2.length > 0) {
5673
+ axios.post(action + '/bulk', sel3).then(function (r) {
5674
+ var d = r.data;
5675
+ console.log(d);
5628
5676
 
5629
- for (var k = 0; k < d.length; k++) {
5630
- if (d[k].error) {
5631
- MsgBox(d[k].error);
5632
- break;
5633
- }
5677
+ for (var k = 0; k < d.length; k++) {
5678
+ if (d[k].error) {
5679
+ MsgBox(d[k].error);
5680
+ break;
5681
+ }
5634
5682
 
5635
- for (var j = 0; j < dats.length; j++) {
5636
- //cada registro recibido de bulk ss compara con los locales
5637
- if (d[k].ext && d[k].ext.tmpId == dats[j].tmpId || d[k].tmpId == dats[j].tmpId) {
5638
- console.log('ok');
5683
+ for (var j = 0; j < dats.length; j++) {
5684
+ //cada registro recibido de bulk ss compara con los locales
5685
+ if (d[k].ext && d[k].ext.tmpId == dats[j].tmpId || d[k].tmpId == dats[j].tmpId) {
5686
+ console.log('ok');
5639
5687
 
5640
- if (d[k].ext && dats.ext) {
5641
- dats[j].ext.error = d[k].ext.error;
5642
- }
5688
+ if (d[k].ext && dats.ext) {
5689
+ dats[j].ext.error = d[k].ext.error;
5690
+ }
5643
5691
 
5644
- if (d[k].id) dats[j].id = d[k].id; //aqui deberia revisarsee los registro anidados
5692
+ if (d[k].id) dats[j].id = d[k].id; //aqui deberia revisarsee los registro anidados
5645
5693
 
5646
- dats[j].tmpSynchronized = 1;
5647
- me.$emit('sync', d[k], dats[j]);
5694
+ dats[j].tmpSynchronized = 1;
5695
+ me.$emit('sync', d[k], dats[j]);
5696
+ }
5648
5697
  }
5649
5698
  }
5650
- }
5651
5699
 
5652
- me.setStoredList(t.storage, dats); //dat.id=r.data.id;
5653
- //t.$emit('synchronized',{data:dat,result:r.data,index:kk,count:tr});
5654
- //dat.tmpSynchronized=1;
5655
- //dats[kk]=dat;
5656
- //sendf(dats,k0+1,te+1);
5700
+ me.setStoredList(t.storage, dats); //dat.id=r.data.id;
5701
+ //t.$emit('synchronized',{data:dat,result:r.data,index:kk,count:tr});
5702
+ //dat.tmpSynchronized=1;
5703
+ //dats[kk]=dat;
5704
+ //sendf(dats,k0+1,te+1);
5657
5705
 
5658
- me.refresh();
5659
- })["catch"](function (r) {
5660
- if (r.response) {
5661
- MsgBox(r.response.data);
5662
- } else {
5663
- console.log(r);
5664
- }
5665
- });
5666
- }
5667
- });
5668
- } catch (e) {
5669
- return Promise.reject(e);
5670
- }
5671
- },
5672
- save: function save() {
5673
- try {
5674
- var _exit2 = false;
5706
+ me.refresh();
5707
+ })["catch"](function (r) {
5708
+ if (r.response) {
5709
+ MsgBox(r.response.data);
5710
+ } else {
5711
+ console.log(r);
5712
+ }
5713
+ });
5714
+ }
5715
+ });
5716
+ } catch (e) {
5717
+ return Promise.reject(e);
5718
+ }
5719
+ },
5720
+ save: function save() {
5721
+ try {
5722
+ var _exit2 = false;
5675
5723
 
5676
- var _this4 = this;
5724
+ var _this4 = this;
5677
5725
 
5678
- var me = _this4;
5679
- me.$forceUpdate();
5680
- var p = me.$el; //Se debe buscar si abajo esta el form
5726
+ var me = _this4;
5727
+ me.$forceUpdate();
5728
+ var p = me.$el; //Se debe buscar si abajo esta el form
5681
5729
 
5682
- var f = p.querySelector("form");
5730
+ var f = p.querySelector("form");
5683
5731
 
5684
- var va = _this4.validate(f);
5732
+ var va = _this4.validate(f);
5685
5733
 
5686
- return function () {
5687
- if (va) {
5688
- var action = f.getAttribute('action'); //console.log('Action='+action);
5734
+ return function () {
5735
+ if (va) {
5736
+ var action = f.getAttribute('action'); //console.log('Action='+action);
5689
5737
 
5690
- if (!action) {
5691
- action = me.$el.parentNode.getAttribute('path');
5738
+ if (!action) {
5739
+ action = me.$el.parentNode.getAttribute('path');
5692
5740
 
5693
- if (action) {
5694
- //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
5695
- var tc = action.split('/');
5696
- if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
5697
- action = me.apiLink(tc.join('/'));
5741
+ if (action) {
5742
+ //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
5743
+ var tc = action.split('/');
5744
+ if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
5745
+ action = me.apiLink(tc.join('/'));
5746
+ }
5698
5747
  }
5699
- }
5700
5748
 
5701
- var o = _this4._data.data ? _this4._data.data : _this4._data.o;
5702
- o = JSON.parse(JSON.stringify(o));
5703
- if (me.process) o = me.process(o); //console.log('o2='+o);
5704
-
5705
- if (!(_typeof(o) === 'object' && !Array.isArray(o) && o !== null)) return;
5706
- return _invoke(function () {
5707
- if (!action || !_this4.app.networkStatus.connected || o.tmpId) {
5708
- var storage = me.$children[0].storage;
5709
- return _await(me.getStoredList(storage), function (datj) {
5710
- //console.log(datj);
5711
- if (!datj) datj = [];
5712
-
5713
- if (o.id) {
5714
- //Si existe se actualiza el registro quitando el flag de sincronizado
5715
- //siempre existe tmpId een los temporales
5716
- for (var k = 0; k < datj.length; k++) {
5717
- if (datj[k].tmpId == o.tmpId) {
5718
- delete o.tmpSynchronized;
5719
- datj[k] = o;
5720
- return;
5749
+ var o = _this4._data.data ? _this4._data.data : _this4._data.o;
5750
+ o = JSON.parse(JSON.stringify(o));
5751
+ if (me.process) o = me.process(o); //console.log('o2='+o);
5752
+
5753
+ if (!(_typeof(o) === 'object' && !Array.isArray(o) && o !== null)) return;
5754
+ return _invoke(function () {
5755
+ if (!action || !_this4.app.networkStatus.connected || o.tmpId) {
5756
+ var storage = me.$children[0].storage;
5757
+ return _await(me.getStoredList(storage), function (datj) {
5758
+ //console.log(datj);
5759
+ if (!datj) datj = [];
5760
+
5761
+ if (o.id) {
5762
+ //Si existe se actualiza el registro quitando el flag de sincronizado
5763
+ //siempre existe tmpId een los temporales
5764
+ for (var k = 0; k < datj.length; k++) {
5765
+ if (datj[k].tmpId == o.tmpId) {
5766
+ delete o.tmpSynchronized;
5767
+ datj[k] = o;
5768
+ return;
5769
+ }
5721
5770
  }
5722
5771
  }
5723
- }
5724
5772
 
5725
- var db = window._.db;
5726
- var objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5727
-
5728
- if (!o.id) {
5729
- o.id = -new Date();
5730
- o.tmpId = +new Date();
5731
- datj.unshift(o);
5732
- objectStore.add(o);
5733
- me.$emit('storage', datj);
5734
- if (me.close2) me.close2({
5735
- data: o
5736
- });else {
5737
- me.close(true);
5738
- }
5739
- } else {
5740
- var item = objectStore.get(o.tmpId);
5741
-
5742
- item.onsuccess = function () {
5743
- if (item.result) {
5744
- //Put see modifica
5745
- objectStore.put(o); //window._.MsgBox('Modificado');
5746
- } else {
5747
- datj.forEach(function (ee) {
5748
- if (ee.tmpId == o.tmpId) {
5749
- objectStore.put(o);
5750
- }
5751
- }); //window._.MsgBox('Agregado');
5752
- }
5773
+ var db = window._.db;
5774
+ var objectStore = db.transaction([storage], "readwrite").objectStore(storage);
5753
5775
 
5776
+ if (!o.id) {
5777
+ o.id = -new Date();
5778
+ o.tmpId = +new Date();
5779
+ datj.unshift(o);
5780
+ objectStore.add(o);
5754
5781
  me.$emit('storage', datj);
5755
5782
  if (me.close2) me.close2({
5756
5783
  data: o
5757
5784
  });else {
5758
5785
  me.close(true);
5759
5786
  }
5760
- };
5761
-
5762
- item.onerror = function () {
5763
- window._.MsgBox('error found ' + o.tmpId);
5764
- };
5765
- }
5766
-
5767
- _exit2 = true;
5768
- });
5769
- }
5770
- }, function (_result) {
5771
- if (_exit2) return _result;
5772
- axios.post(action, o).then(function (r) {
5773
- MsgBox('El registro fue grabado exitosamente!', function () {
5774
- if (me.close2) me.close2(r);else {
5775
- me.close(true);
5776
- }
5777
- });
5778
- })["catch"](function (r) {
5779
- if (r.response) {
5780
- var l, e;
5781
-
5782
- if (typeof r.response.data === 'string') {
5783
- MsgBox(r.response.data);
5784
- } else {
5785
- l = r.response.data.propertyViolations; //ec += l.length;
5786
-
5787
- for (var i = 0; i < l.length; i++) {
5788
- var t = l[i];
5789
- e = f.querySelector('[name=' + t.path + ']');
5787
+ } else {
5788
+ var item = objectStore.get(o.tmpId);
5789
+
5790
+ item.onsuccess = function () {
5791
+ if (item.result) {
5792
+ //Put see modifica
5793
+ objectStore.put(o); //window._.MsgBox('Modificado');
5794
+ } else {
5795
+ datj.forEach(function (ee) {
5796
+ if (ee.tmpId == o.tmpId) {
5797
+ objectStore.put(o);
5798
+ }
5799
+ }); //window._.MsgBox('Agregado');
5800
+ }
5801
+
5802
+ me.$emit('storage', datj);
5803
+ if (me.close2) me.close2({
5804
+ data: o
5805
+ });else {
5806
+ me.close(true);
5807
+ }
5808
+ };
5809
+
5810
+ item.onerror = function () {
5811
+ window._.MsgBox('error found ' + o.tmpId);
5812
+ };
5813
+ }
5790
5814
 
5791
- if (e) {
5792
- me.showerror(e, t.message);
5793
- }
5815
+ _exit2 = true;
5816
+ });
5817
+ }
5818
+ }, function (_result) {
5819
+ if (_exit2) return _result;
5820
+ axios.post(action, o).then(function (r) {
5821
+ MsgBox('El registro fue grabado exitosamente!', function () {
5822
+ if (me.close2) me.close2(r);else {
5823
+ me.close(true);
5794
5824
  }
5825
+ });
5826
+ })["catch"](function (r) {
5827
+ if (r.response) {
5828
+ var l, e;
5829
+
5830
+ if (typeof r.response.data === 'string') {
5831
+ MsgBox(r.response.data);
5832
+ } else {
5833
+ l = r.response.data.propertyViolations; //ec += l.length;
5834
+
5835
+ for (var i = 0; i < l.length; i++) {
5836
+ var t = l[i];
5837
+ e = f.querySelector('[name=' + t.path + ']');
5838
+
5839
+ if (e) {
5840
+ me.showerror(e, t.message);
5841
+ }
5842
+ }
5795
5843
 
5796
- l = r.response.data.fieldViolations; //ec += l.length;
5844
+ l = r.response.data.fieldViolations; //ec += l.length;
5797
5845
 
5798
- for (i = 0; i < l.length; i++) {
5799
- t = l[i];
5800
- e = f.querySelector('[name=' + t.path + ']');
5846
+ for (i = 0; i < l.length; i++) {
5847
+ t = l[i];
5848
+ e = f.querySelector('[name=' + t.path + ']');
5801
5849
 
5802
- if (e) {
5803
- me.showerror(e, t.message + ', valor=' + t.value);
5850
+ if (e) {
5851
+ me.showerror(e, t.message + ', valor=' + t.value);
5852
+ }
5804
5853
  }
5805
- }
5806
5854
 
5807
- MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
5808
- if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
5809
- top: 0,
5810
- behavior: 'smooth'
5811
- });
5855
+ MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
5856
+ if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
5857
+ top: 0,
5858
+ behavior: 'smooth'
5859
+ });
5860
+ }
5812
5861
  }
5813
- }
5862
+ });
5814
5863
  });
5815
- });
5816
- } else {
5817
- MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
5818
- if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
5819
- top: 0,
5820
- behavior: 'smooth'
5821
- });
5822
- }
5823
- }();
5824
- } catch (e) {
5825
- return Promise.reject(e);
5826
- }
5827
- },
5828
- savePost: function savePost() {},
5829
- validate: function validate(e2) {
5830
- var me = this;
5831
- var ok = true;
5832
- e2 = e2 ? e2 : me.$el;
5833
- var input = e2.querySelectorAll("input,select,textarea,div[required=required]");
5834
- var radio = {},
5835
- previousSibling;
5836
-
5837
- for (i = 0; input.length > i; i++) {
5838
- var e = input[i];
5839
-
5840
- if (e.type === 'radio') {
5841
- var oo = radio[e.name];
5842
- if (!oo) radio[e.name] = oo = [];
5843
- oo.push(e);
5844
- continue;
5864
+ } else {
5865
+ MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
5866
+ if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
5867
+ top: 0,
5868
+ behavior: 'smooth'
5869
+ });
5870
+ }
5871
+ }();
5872
+ } catch (e) {
5873
+ return Promise.reject(e);
5845
5874
  }
5875
+ },
5876
+ savePost: function savePost() {},
5877
+ validate: function validate(e2) {
5878
+ var me = this;
5879
+ var ok = true;
5880
+ e2 = e2 ? e2 : me.$el;
5881
+ var input = e2.querySelectorAll("input,select,textarea,div[required=required]");
5882
+ var radio = {},
5883
+ previousSibling;
5884
+
5885
+ for (i = 0; input.length > i; i++) {
5886
+ var e = input[i];
5887
+
5888
+ if (e.type === 'radio') {
5889
+ var oo = radio[e.name];
5890
+ if (!oo) radio[e.name] = oo = [];
5891
+ oo.push(e);
5892
+ continue;
5893
+ }
5846
5894
 
5847
- previousSibling = e.previousSibling;
5848
-
5849
- if (previousSibling && previousSibling.classList && previousSibling.classList.contains('v-error')) {
5850
- previousSibling.parentNode.removeChild(previousSibling);
5851
- } // console.log('disabled='+e.getAttribute('disabled'));
5852
-
5895
+ previousSibling = e.previousSibling;
5853
5896
 
5854
- if (!(e.disabled || e.getAttribute('disabled')) && (e.required || e.tagName === 'DIV')) {
5855
- //console.log([e]);
5856
- //console.log(e.value);console.log(e.nodeValue);
5857
- if (e.tagName != 'DIV' && !e.value
5858
- /*||e.value == 0*/
5859
- || e.tagName === 'DIV' && !e.attributes.value) {
5860
- previousSibling = e.previousSibling;
5897
+ if (previousSibling && previousSibling.classList && previousSibling.classList.contains('v-error')) {
5898
+ previousSibling.parentNode.removeChild(previousSibling);
5899
+ } // console.log('disabled='+e.getAttribute('disabled'));
5861
5900
 
5862
- while (previousSibling && previousSibling.nodeType != 1) {
5863
- previousSibling = previousSibling.previousSibling;
5864
- }
5865
5901
 
5866
- if (!previousSibling) {
5867
- previousSibling = e.parentElement.previousSibling;
5902
+ if (!(e.disabled || e.getAttribute('disabled')) && (e.required || e.tagName === 'DIV')) {
5903
+ //console.log([e]);
5904
+ //console.log(e.value);console.log(e.nodeValue);
5905
+ if (e.tagName != 'DIV' && !e.value
5906
+ /*||e.value == 0*/
5907
+ || e.tagName === 'DIV' && !e.attributes.value) {
5908
+ previousSibling = e.previousSibling;
5868
5909
 
5869
5910
  while (previousSibling && previousSibling.nodeType != 1) {
5870
5911
  previousSibling = previousSibling.previousSibling;
5871
5912
  }
5872
- }
5873
5913
 
5874
- var error = document.createElement("div");
5875
- error.innerHTML = "Este campo es requerido!";
5876
- ok = false;
5877
- error.classList.add("v-error");
5878
- e.parentNode.insertBefore(error, e);
5914
+ if (!previousSibling) {
5915
+ previousSibling = e.parentElement.previousSibling;
5916
+
5917
+ while (previousSibling && previousSibling.nodeType != 1) {
5918
+ previousSibling = previousSibling.previousSibling;
5919
+ }
5920
+ }
5921
+
5922
+ var error = document.createElement("div");
5923
+ error.innerHTML = "Este campo es requerido!";
5924
+ ok = false;
5925
+ error.classList.add("v-error");
5926
+ e.parentNode.insertBefore(error, e);
5927
+ }
5879
5928
  }
5880
5929
  }
5881
- }
5882
5930
 
5883
- for (var r in radio) {
5884
- if (Object.prototype.hasOwnProperty.call(radio, r)) {
5885
- var op = radio[r];
5886
- var checked = false;
5887
- var required = false;
5931
+ for (var r in radio) {
5932
+ if (Object.prototype.hasOwnProperty.call(radio, r)) {
5933
+ var op = radio[r];
5934
+ var checked = false;
5935
+ var required = false;
5888
5936
 
5889
- for (var i = 0; i < op.length; i++) {
5890
- if (op[i].required && !op[i].disabled) required = true;
5891
- if (op[i].checked) checked = true;
5892
- }
5937
+ for (var i = 0; i < op.length; i++) {
5938
+ if (op[i].required && !op[i].disabled) required = true;
5939
+ if (op[i].checked) checked = true;
5940
+ }
5893
5941
 
5894
- e = op[0].parentNode.parentNode;
5895
- previousSibling = e.previousSibling;
5942
+ e = op[0].parentNode.parentNode;
5943
+ previousSibling = e.previousSibling;
5896
5944
 
5897
- if (previousSibling && previousSibling.classList && previousSibling.classList.contains('v-error')) {
5898
- previousSibling.parentNode.removeChild(previousSibling);
5899
- }
5945
+ if (previousSibling && previousSibling.classList && previousSibling.classList.contains('v-error')) {
5946
+ previousSibling.parentNode.removeChild(previousSibling);
5947
+ }
5900
5948
 
5901
- if (required && !checked) {
5902
- me.showerror(e);
5903
- /*previousSibling = e.previousSibling;
5904
- while(previousSibling&&previousSibling.nodeType != 1) {
5905
- previousSibling = previousSibling.previousSibling;
5906
- }
5907
- if(!previousSibling){
5908
- previousSibling=e.parentElement.previousSibling;
5909
- while(previousSibling&&previousSibling.nodeType != 1) {
5910
- previousSibling = previousSibling.previousSibling;
5911
- }
5912
- }
5913
- var error = document.createElement("div");
5914
- error.innerHTML = "Este campo es requerido!";*/
5915
-
5916
- ok = false; //error.classList.add("v-error");
5917
- //e.parentNode.insertBefore(error, e);
5949
+ if (required && !checked) {
5950
+ me.showerror(e);
5951
+ /*previousSibling = e.previousSibling;
5952
+ while(previousSibling&&previousSibling.nodeType != 1) {
5953
+ previousSibling = previousSibling.previousSibling;
5954
+ }
5955
+ if(!previousSibling){
5956
+ previousSibling=e.parentElement.previousSibling;
5957
+ while(previousSibling&&previousSibling.nodeType != 1) {
5958
+ previousSibling = previousSibling.previousSibling;
5959
+ }
5960
+ }
5961
+ var error = document.createElement("div");
5962
+ error.innerHTML = "Este campo es requerido!";*/
5963
+
5964
+ ok = false; //error.classList.add("v-error");
5965
+ //e.parentNode.insertBefore(error, e);
5966
+ }
5918
5967
  }
5919
5968
  }
5920
- }
5921
-
5922
- return ok;
5923
- },
5924
- showerror: function showerror(e, m) {
5925
- var previousSibling = e.previousSibling;
5926
-
5927
- if (previousSibling && previousSibling.classList && previousSibling.classList.contains('v-error')) {
5928
- previousSibling.parentNode.removeChild(previousSibling);
5929
- }
5930
5969
 
5931
- previousSibling = e.previousSibling;
5970
+ return ok;
5971
+ },
5972
+ showerror: function showerror(e, m) {
5973
+ var previousSibling = e.previousSibling;
5932
5974
 
5933
- while (previousSibling && previousSibling.nodeType != 1) {
5934
- previousSibling = previousSibling.previousSibling;
5935
- }
5975
+ if (previousSibling && previousSibling.classList && previousSibling.classList.contains('v-error')) {
5976
+ previousSibling.parentNode.removeChild(previousSibling);
5977
+ }
5936
5978
 
5937
- if (!previousSibling) {
5938
- previousSibling = e.parentElement.previousSibling;
5979
+ previousSibling = e.previousSibling;
5939
5980
 
5940
5981
  while (previousSibling && previousSibling.nodeType != 1) {
5941
5982
  previousSibling = previousSibling.previousSibling;
5942
5983
  }
5943
- }
5944
-
5945
- var error = document.createElement("div");
5946
- error.innerHTML = m ? m : "Este campo es requerido!"; //ok = false;
5947
5984
 
5948
- error.classList.add("v-error");
5949
- e.parentNode.insertBefore(error, e);
5950
- }
5951
- }
5952
- };
5953
-
5954
- function isObject(item) {
5955
- return item && _typeof(item) === 'object' && !Array.isArray(item);
5956
- }
5957
-
5958
- Vue.mergeDeep = function () {
5959
- var target = arguments[0];
5960
- var sources = [];
5961
-
5962
- for (var i = 1; i < arguments.length; i++) {
5963
- sources.push(arguments[i]);
5964
- } //Vue.mergeDeep = function(target, ...sources) {
5965
-
5966
-
5967
- if (!sources.length) return target; //Se obtiene el primer elemento de source
5968
-
5969
- var source = sources.shift(),
5970
- nv; //const source = sources.shift();
5971
-
5972
- if (isObject(target) && isObject(source)) {
5973
- for (var key in source) {
5974
- //for (const key in source) {
5975
- if (isObject(source[key])) {
5976
- console.log(key);
5977
- console.log(source[key]);
5985
+ if (!previousSibling) {
5986
+ previousSibling = e.parentElement.previousSibling;
5978
5987
 
5979
- if (!target[key]) {
5980
- nv = {};
5981
- nv[key] = {};
5982
- Object.assign(target, nv);
5988
+ while (previousSibling && previousSibling.nodeType != 1) {
5989
+ previousSibling = previousSibling.previousSibling;
5990
+ }
5983
5991
  }
5984
5992
 
5985
- Vue.mergeDeep(target[key], source[key]);
5986
- } else {
5987
- nv = {};
5988
- nv[key] = source[key];
5989
- Object.assign(target, nv); //Object.assign(target, { [key]: source[key] });
5993
+ var error = document.createElement("div");
5994
+ error.innerHTML = m ? m : "Este campo es requerido!"; //ok = false;
5995
+
5996
+ error.classList.add("v-error");
5997
+ e.parentNode.insertBefore(error, e);
5990
5998
  }
5991
5999
  }
5992
- }
5993
-
5994
- var args = [];
5995
- args.push(target);
5996
- return Vue.mergeDeep.apply(null, args); //return mergeDeep(target, ...sources);
5997
- };
5998
-
5999
- window.ui = _.ui = function (cfg) {
6000
+ };
6000
6001
  if (!cfg) cfg = {
6001
6002
  data: {
6002
6003
  o: {}