isobit-ui 0.2.134 → 0.2.136

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 +1032 -1061
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * isobit-ui v0.2.133
2
+ * isobit-ui v0.2.135
3
3
  * (c) Erik Alarcon Pinedo
4
4
  * Released under the MIT License.
5
5
  */
@@ -56,20 +56,6 @@ function _typeof(obj) {
56
56
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
57
57
  }, _typeof(obj);
58
58
  }
59
- function _defineProperty(obj, key, value) {
60
- key = _toPropertyKey(key);
61
- if (key in obj) {
62
- Object.defineProperty(obj, key, {
63
- value: value,
64
- enumerable: true,
65
- configurable: true,
66
- writable: true
67
- });
68
- } else {
69
- obj[key] = value;
70
- }
71
- return obj;
72
- }
73
59
  function _slicedToArray(arr, i) {
74
60
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
75
61
  }
@@ -155,20 +141,6 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
155
141
  }
156
142
  };
157
143
  }
158
- function _toPrimitive(input, hint) {
159
- if (typeof input !== "object" || input === null) return input;
160
- var prim = input[Symbol.toPrimitive];
161
- if (prim !== undefined) {
162
- var res = prim.call(input, hint || "default");
163
- if (typeof res !== "object") return res;
164
- throw new TypeError("@@toPrimitive must return a primitive value.");
165
- }
166
- return (hint === "string" ? String : Number)(input);
167
- }
168
- function _toPropertyKey(arg) {
169
- var key = _toPrimitive(arg, "string");
170
- return typeof key === "symbol" ? key : String(key);
171
- }
172
144
 
173
145
  //
174
146
  //
@@ -6289,8 +6261,7 @@ Vue__default["default"].mergeDeep = function () {
6289
6261
  };
6290
6262
 
6291
6263
  window.ui = _$1.ui = function (cfg) {
6292
- var _defs;
6293
- var defs = (_defs = {
6264
+ var defs = {
6294
6265
  watch: {
6295
6266
  $route: function $route(v) {
6296
6267
  Vue__default["default"].resize();
@@ -6306,12 +6277,6 @@ window.ui = _$1.ui = function (cfg) {
6306
6277
  }
6307
6278
  }
6308
6279
  },
6309
- data: function data() {
6310
- return {
6311
- _connected: null,
6312
- opt: 112
6313
- };
6314
- },
6315
6280
  computed: {
6316
6281
  connected: {
6317
6282
  get: function get() {
@@ -6369,1116 +6334,1122 @@ window.ui = _$1.ui = function (cfg) {
6369
6334
  baseURL: function baseURL() {
6370
6335
  return Vue__default["default"].baseURL ? Vue__default["default"].baseURL : axios__default["default"].defaults.baseURL;
6371
6336
  }
6372
- }
6373
- }, _defineProperty(_defs, "data", function data() {
6374
- var me = this;
6375
- return {
6376
- filters: {},
6377
- ui: me,
6378
- _session: null,
6379
- //rowSelectedCount: 0,
6380
- row: {}
6381
- };
6382
- }), _defineProperty(_defs, "updated", function updated() {
6383
- // console.log(this);
6384
- }), _defineProperty(_defs, "mounted", function mounted() {
6385
- var me = this;
6386
- var vueid = _$1.id();
6387
- //error cuando se carga un mapa con v-panel el mapa de turismo es ejemplo
6388
- if (me.$el && me.$el.setAttribute) {
6389
- me.$el.setAttribute("vueid", vueid);
6390
- }
6391
- _$1.varMap[vueid] = me;
6392
- me.ddd(me.$root);
6393
- }), _defineProperty(_defs, "methods", {
6394
- resize: function resize() {
6395
- Vue__default["default"].resize();
6396
6337
  },
6397
- vv: function vv(v) {
6338
+ data: function data() {
6398
6339
  var me = this;
6399
- var sf = function sf(status) {
6400
- if (status.connected) {
6401
- var session = localStorage.getItem('session');
6402
- if (session) {
6403
- try {
6404
- session = JSON.parse(session);
6405
- } catch (e) {
6406
- console.log(e);
6407
- session = {};
6408
- }
6409
- session.connected = v;
6410
- localStorage.setItem('session', JSON.stringify(session));
6411
- }
6412
- } else {
6413
- me.toast('El dispositivo no tiene acceso a internet!');
6414
- me.connected = status.connected;
6415
- }
6340
+ return {
6341
+ filters: {},
6342
+ ui: me,
6343
+ _session: null,
6344
+ _connected: null,
6345
+ opt: 1111,
6346
+ //rowSelectedCount: 0,
6347
+ row: {}
6416
6348
  };
6417
- Network.getStatus().then(sf);
6418
- },
6419
- bindLinks: function bindLinks(el, callback) {
6420
- var me = this;
6421
- el = el ? el : me.$el;
6422
- //console.log(el);
6423
- //console.log("ENTLO")
6424
- if (el.querySelectorAll) {
6425
- //var a=el.querySelectorAll('a:not(._),ion-item:not(._)');
6426
- var a = el.querySelectorAll('a:not(._),ion-item:not(._)');
6427
- //console.log(a)
6428
- var f0 = function f0(e) {
6429
- e.preventDefault();
6430
- };
6431
- var f = function f(e) {
6432
- e.preventDefault();
6433
- if (callback) callback();
6434
- me.open(e);
6435
- };
6436
- for (var i = 0; i < a.length; i++) {
6437
- if (a[i].attributes.href) {
6438
- a[i].onclick = f;
6439
- } else a[i].onclick = f0;
6440
- a[i].classList ? a[i].classList.add('_') : a[i].className = '_';
6441
- }
6442
- }
6443
- },
6444
- MsgBox: _$1.MsgBox,
6445
- changeRoute: function changeRoute() {/*console.log(v)*/},
6446
- pad: Vue__default["default"].pad,
6447
- key: function key() {
6448
- return Math.random();
6449
- },
6450
- submitFile: function submitFile(f, name, cb) {
6451
- var formData = new FormData();
6452
- name = name ? name : f.name.replace(/[^\w\s.]/gi, '');
6453
- formData.append('filename', name);
6454
- formData.append('file', f, name);
6455
- axios__default["default"].post('/api/file/upload', formData, {
6456
- headers: {
6457
- 'Content-Type': 'multipart/form-data',
6458
- filename: name
6459
- }
6460
- }).then(function (r) {
6461
- cb(r.data);
6462
- })["catch"](function () {
6463
- console.log('FAILURE!!');
6464
- });
6465
- },
6466
- go: function go(e) {
6467
- window.o(e);
6468
- },
6469
- ddd: function ddd() {
6470
- // for(var i=0;i<o.$children.length;i++){
6471
- // var child=o.$children[i];
6472
- // console.log(child);
6473
- // if (child.$vnode.tag && child.$vnode.tag.includes("v-table")) {
6474
- // //child.setColumns(columns);
6475
- // }else{
6476
- // this.ddd(child);
6477
- // }
6478
- // }
6479
- } /*o*/,
6480
- rowCreated: function rowCreated(r) {
6481
- this.row = r;
6482
- },
6483
- getSelected: function getSelected(e) {
6484
- var me = this;
6485
- var t = e && e.$vnode ? e : me.$children[0].$children[0];
6486
- var s = [];
6487
- for (var i = 0; i < t.selected.length; i++) {
6488
- s.push(t.data[t.selected[i]]);
6489
- }
6490
- return s;
6491
- },
6492
- getRowSelectedCount: function getRowSelectedCount() {
6493
- var me = this;
6494
- var t = me.$children[0].$children[0];
6495
- return t ? t.selected.length : 0;
6496
- },
6497
- rewrite: function rewrite(url) {
6498
- return url;
6499
6349
  },
6500
- create: function create() {
6501
- var me = this;
6502
- var action = me.$children[0].action;
6503
- if (!action) action = window.location.pathname;
6504
- action = _$1.processURL(action);
6505
- if (action) action = action.replace("/api", "");
6506
- if (_$1.app) {
6507
- me.open(action + '/create');
6508
- } else {
6509
- instance.get(_$1.currentPath = (action + '/create').replace(/([^:]\/)\/+/g, "$1") + '?modal').then(_$1.open)["catch"](me.error);
6510
- }
6350
+ updated: function updated() {
6351
+ // console.log(this);
6511
6352
  },
6512
- edit: function edit(e) {
6353
+ mounted: function mounted() {
6513
6354
  var me = this;
6514
- var f = me.$children[0];
6515
- var action = f.action;
6516
- var t = [].filter.call(e.component.$parent.$children, function (e) {
6517
- return e.$el.classList.contains('v-datatable');
6518
- })[0];
6519
- if (!action) {
6520
- action = window.location.pathname;
6521
- }
6522
- if (t && t.src) action = t.src;
6523
- if (e.action) action = e.action;
6524
- if (!t) {
6525
- t = e.$vnode ? e : e.target && e.target.$vnode ? e : me.$children[0].$children[0];
6526
- if (t.src) action = t.src;
6527
- }
6528
- if (action) action = me.rewrite(action.replace("/api", "").replace("/0/0", ""));
6529
- var selected = me.getSelected(t)[0];
6530
- var id = selected[t.rowKey];
6531
- if (selected.tmpId) id = -selected.tmpId;
6532
- console.log(selected);
6533
- if (me.getSelectedId) id = me.getSelectedId(selected);
6534
- if (_$1.app) {
6535
- me.open(action + '/' + id + '/edit');
6536
- } else {
6537
- axios__default["default"].get((_$1.currentPath = (action + '/' + id + '/edit').replace(/([^:]\/)\/+/g, "$1")) + '?modal').then(me.open)["catch"](me.error);
6355
+ var vueid = _$1.id();
6356
+ //error cuando se carga un mapa con v-panel el mapa de turismo es ejemplo
6357
+ if (me.$el && me.$el.setAttribute) {
6358
+ me.$el.setAttribute("vueid", vueid);
6538
6359
  }
6360
+ _$1.varMap[vueid] = me;
6361
+ me.ddd(me.$root);
6539
6362
  },
6540
- get: function get(part) {
6541
- var me = this;
6542
- var p = me.$el;
6543
- //Se debe buscar si abajo esta el form
6544
- var f = p.querySelector("form");
6545
- var action = f.action;
6546
- //console.log(me.apiLink(action) + '/' + part);
6547
- window.location.href = me.apiLink(action) + '/' + part;
6548
- },
6549
- error: function error(e) {
6550
- //console.log(e);
6551
- alert(e);
6552
- //this.open({data:''+e});
6553
- },
6554
- destroy: function destroy(e) {
6555
- var me = this;
6556
- var f = me.$children[0];
6557
- f.action;
6558
- var t = [].filter.call(e.component.$parent.$children, function (e) {
6559
- return e.$el.classList.contains('v-datatable');
6560
- })[0];
6561
- if (!t) t = e.$vnode ? e : me.$children[0].$children[0];
6562
- var cb = e.$vnode ? e.load : null;
6563
- var key = t.$attrs.rowkey;
6564
- if (!key) key = t.rowKey;
6565
- var dat = t.data[t.selected[0]];
6566
- t.data;
6567
- if (dat.tmpId) {
6568
- me.MsgBox('Esta seguro que desea eliminar los registros temporales seleccionados ?', function (r) {
6569
- if (r == 0) {
6570
- var c = 0,
6571
- db = _$1.db;
6572
- var objectStore = db.transaction([t.store], "readwrite").objectStore(t.store);
6573
- var ele = [];
6574
- for (var k = t.selected.length - 1; k >= 0; k--) {
6575
- dat = t.data[t.selected[k]];
6576
- ele.push(dat);
6577
- if (dat.tmpId) objectStore["delete"](dat.tmpId);
6578
- c++;
6579
- t.data.splice(t.selected[k], 1);
6580
- }
6581
- if (c) {
6582
- if (me.app && me.app.toast) me.app.toast(c + ' registros eliminados');else me.MsgBox(c + ' registros eliminados');
6363
+ methods: {
6364
+ resize: function resize() {
6365
+ Vue__default["default"].resize();
6366
+ },
6367
+ vv: function vv(v) {
6368
+ var me = this;
6369
+ var sf = function sf(status) {
6370
+ if (status.connected) {
6371
+ var session = localStorage.getItem('session');
6372
+ if (session) {
6373
+ try {
6374
+ session = JSON.parse(session);
6375
+ } catch (e) {
6376
+ console.log(e);
6377
+ session = {};
6378
+ }
6379
+ session.connected = v;
6380
+ localStorage.setItem('session', JSON.stringify(session));
6583
6381
  }
6584
- t.rowSelect(null, -1);
6585
- t.selected = [];
6586
- me.$emit('destroyed', ele, t.store);
6587
- if (cb) cb();
6382
+ } else {
6383
+ me.toast('El dispositivo no tiene acceso a internet!');
6384
+ me.connected = status.connected;
6588
6385
  }
6589
- }, ['SI', 'NO']);
6590
- } else {
6591
- if (!key) return alert('Table don`t have defined attribute \'rowkey\'');
6592
- var id = dat[key];
6593
- me.MsgBox('Esta seguro que desea eliminar el registro seleccionado?', function (r) {
6594
- if (r == 0) {
6595
- var src = t.src.replace('/0/0', '');
6596
- var ele = [];
6597
- console.log(t.selected);
6598
- var k = t.selected.length - 1;
6599
- axios__default["default"]["delete"](src + '/' + id, {
6600
- params: t.filters
6601
- }).then(function () {
6602
- console.log(t.selected);
6603
- for (; k >= 0; k--) {
6604
- console.log('k=' + k);
6605
- console.log(t.data);
6606
- console.log('t.selected[k]=' + t.selected[k]);
6386
+ };
6387
+ Network.getStatus().then(sf);
6388
+ },
6389
+ bindLinks: function bindLinks(el, callback) {
6390
+ var me = this;
6391
+ el = el ? el : me.$el;
6392
+ //console.log(el);
6393
+ //console.log("ENTLO")
6394
+ if (el.querySelectorAll) {
6395
+ //var a=el.querySelectorAll('a:not(._),ion-item:not(._)');
6396
+ var a = el.querySelectorAll('a:not(._),ion-item:not(._)');
6397
+ //console.log(a)
6398
+ var f0 = function f0(e) {
6399
+ e.preventDefault();
6400
+ };
6401
+ var f = function f(e) {
6402
+ e.preventDefault();
6403
+ if (callback) callback();
6404
+ me.open(e);
6405
+ };
6406
+ for (var i = 0; i < a.length; i++) {
6407
+ if (a[i].attributes.href) {
6408
+ a[i].onclick = f;
6409
+ } else a[i].onclick = f0;
6410
+ a[i].classList ? a[i].classList.add('_') : a[i].className = '_';
6411
+ }
6412
+ }
6413
+ },
6414
+ MsgBox: _$1.MsgBox,
6415
+ changeRoute: function changeRoute() {/*console.log(v)*/},
6416
+ pad: Vue__default["default"].pad,
6417
+ key: function key() {
6418
+ return Math.random();
6419
+ },
6420
+ submitFile: function submitFile(f, name, cb) {
6421
+ var formData = new FormData();
6422
+ name = name ? name : f.name.replace(/[^\w\s.]/gi, '');
6423
+ formData.append('filename', name);
6424
+ formData.append('file', f, name);
6425
+ axios__default["default"].post('/api/file/upload', formData, {
6426
+ headers: {
6427
+ 'Content-Type': 'multipart/form-data',
6428
+ filename: name
6429
+ }
6430
+ }).then(function (r) {
6431
+ cb(r.data);
6432
+ })["catch"](function () {
6433
+ console.log('FAILURE!!');
6434
+ });
6435
+ },
6436
+ go: function go(e) {
6437
+ window.o(e);
6438
+ },
6439
+ ddd: function ddd() {
6440
+ // for(var i=0;i<o.$children.length;i++){
6441
+ // var child=o.$children[i];
6442
+ // console.log(child);
6443
+ // if (child.$vnode.tag && child.$vnode.tag.includes("v-table")) {
6444
+ // //child.setColumns(columns);
6445
+ // }else{
6446
+ // this.ddd(child);
6447
+ // }
6448
+ // }
6449
+ } /*o*/,
6450
+ rowCreated: function rowCreated(r) {
6451
+ this.row = r;
6452
+ },
6453
+ getSelected: function getSelected(e) {
6454
+ var me = this;
6455
+ var t = e && e.$vnode ? e : me.$children[0].$children[0];
6456
+ var s = [];
6457
+ for (var i = 0; i < t.selected.length; i++) {
6458
+ s.push(t.data[t.selected[i]]);
6459
+ }
6460
+ return s;
6461
+ },
6462
+ getRowSelectedCount: function getRowSelectedCount() {
6463
+ var me = this;
6464
+ var t = me.$children[0].$children[0];
6465
+ return t ? t.selected.length : 0;
6466
+ },
6467
+ rewrite: function rewrite(url) {
6468
+ return url;
6469
+ },
6470
+ create: function create() {
6471
+ var me = this;
6472
+ var action = me.$children[0].action;
6473
+ if (!action) action = window.location.pathname;
6474
+ action = _$1.processURL(action);
6475
+ if (action) action = action.replace("/api", "");
6476
+ if (_$1.app) {
6477
+ me.open(action + '/create');
6478
+ } else {
6479
+ instance.get(_$1.currentPath = (action + '/create').replace(/([^:]\/)\/+/g, "$1") + '?modal').then(_$1.open)["catch"](me.error);
6480
+ }
6481
+ },
6482
+ edit: function edit(e) {
6483
+ var me = this;
6484
+ var f = me.$children[0];
6485
+ var action = f.action;
6486
+ var t = [].filter.call(e.component.$parent.$children, function (e) {
6487
+ return e.$el.classList.contains('v-datatable');
6488
+ })[0];
6489
+ if (!action) {
6490
+ action = window.location.pathname;
6491
+ }
6492
+ if (t && t.src) action = t.src;
6493
+ if (e.action) action = e.action;
6494
+ if (!t) {
6495
+ t = e.$vnode ? e : e.target && e.target.$vnode ? e : me.$children[0].$children[0];
6496
+ if (t.src) action = t.src;
6497
+ }
6498
+ if (action) action = me.rewrite(action.replace("/api", "").replace("/0/0", ""));
6499
+ var selected = me.getSelected(t)[0];
6500
+ var id = selected[t.rowKey];
6501
+ if (selected.tmpId) id = -selected.tmpId;
6502
+ console.log(selected);
6503
+ if (me.getSelectedId) id = me.getSelectedId(selected);
6504
+ if (_$1.app) {
6505
+ me.open(action + '/' + id + '/edit');
6506
+ } else {
6507
+ axios__default["default"].get((_$1.currentPath = (action + '/' + id + '/edit').replace(/([^:]\/)\/+/g, "$1")) + '?modal').then(me.open)["catch"](me.error);
6508
+ }
6509
+ },
6510
+ get: function get(part) {
6511
+ var me = this;
6512
+ var p = me.$el;
6513
+ //Se debe buscar si abajo esta el form
6514
+ var f = p.querySelector("form");
6515
+ var action = f.action;
6516
+ //console.log(me.apiLink(action) + '/' + part);
6517
+ window.location.href = me.apiLink(action) + '/' + part;
6518
+ },
6519
+ error: function error(e) {
6520
+ //console.log(e);
6521
+ alert(e);
6522
+ //this.open({data:''+e});
6523
+ },
6524
+ destroy: function destroy(e) {
6525
+ var me = this;
6526
+ var f = me.$children[0];
6527
+ f.action;
6528
+ var t = [].filter.call(e.component.$parent.$children, function (e) {
6529
+ return e.$el.classList.contains('v-datatable');
6530
+ })[0];
6531
+ if (!t) t = e.$vnode ? e : me.$children[0].$children[0];
6532
+ var cb = e.$vnode ? e.load : null;
6533
+ var key = t.$attrs.rowkey;
6534
+ if (!key) key = t.rowKey;
6535
+ var dat = t.data[t.selected[0]];
6536
+ t.data;
6537
+ if (dat.tmpId) {
6538
+ me.MsgBox('Esta seguro que desea eliminar los registros temporales seleccionados ?', function (r) {
6539
+ if (r == 0) {
6540
+ var c = 0,
6541
+ db = _$1.db;
6542
+ var objectStore = db.transaction([t.store], "readwrite").objectStore(t.store);
6543
+ var ele = [];
6544
+ for (var k = t.selected.length - 1; k >= 0; k--) {
6607
6545
  dat = t.data[t.selected[k]];
6608
6546
  ele.push(dat);
6609
- console.log(ele);
6547
+ if (dat.tmpId) objectStore["delete"](dat.tmpId);
6548
+ c++;
6610
6549
  t.data.splice(t.selected[k], 1);
6611
6550
  }
6612
- if (me.app && me.app.toast) me.app.toast(ele.length + ' registros eliminados');else me.MsgBox(ele.length + ' registros eliminados');
6551
+ if (c) {
6552
+ if (me.app && me.app.toast) me.app.toast(c + ' registros eliminados');else me.MsgBox(c + ' registros eliminados');
6553
+ }
6613
6554
  t.rowSelect(null, -1);
6614
6555
  t.selected = [];
6615
- //if(cb)cb();
6616
- })["catch"](me.error);
6617
- //t.rowSelect(null,-1);
6618
- }
6619
- }, ['SI', 'NO']);
6620
- }
6621
- },
6622
- apiLink: function apiLink(str) {
6623
- return str.replace(_$1.contextPath, _$1.contextPath + '/api');
6624
- },
6625
- open: function open(response, path, o) {
6626
- if (!response.$el && !(response instanceof HTMLElement)) {
6627
- var e = response;
6628
- var t = e.target;
6629
- var me = this;
6630
- if (typeof e == 'string') {
6631
- t = e;
6632
- } else if (t.tagName == "ION-ITEM" && t.href) {
6633
- e.preventDefault();
6634
- t = t.href;
6556
+ me.$emit('destroyed', ele, t.store);
6557
+ if (cb) cb();
6558
+ }
6559
+ }, ['SI', 'NO']);
6635
6560
  } else {
6636
- e.preventDefault();
6637
- if (!t.pathname) t = t.parentNode;
6638
- if (!t.pathname) t = t.parentNode;
6639
- if (!t.pathname) t = t.parentNode;
6640
- t = t.pathname;
6641
- }
6642
- if (me.$route.path !== t) {
6643
- console.log('path=' + t);
6644
- me.$router.push(t);
6645
- }
6646
- return;
6647
- }
6648
- var me = this,
6649
- el;
6650
- if (response.$el) {
6651
- response = response.$el;
6652
- path = {};
6653
- } else if (response instanceof HTMLElement) {
6654
- path = path && path.closeOnClickOut ? path : {};
6655
- console.log("PATH====");
6656
- console.log(path);
6657
- } else if (response.target) {
6658
- el = response.target;
6659
- return me.open(el.pathname ? el.pathname : el.href);
6660
- } else if (response === 'GET') {
6661
- if (typeof path == 'string') {
6662
- var cfg = {
6663
- path: _$1.currentPath = path + (typeof o == 'string' ? '/' + o : '')
6664
- };
6665
- if (typeof o == 'function') {
6666
- cfg.result = o;
6667
- } else if (_typeof(o) == 'object') {
6668
- cfg = Vue__default["default"].mergeDeep(cfg, o);
6669
- }
6670
- return me.open(response, cfg);
6671
- } else if (!path.data) {
6672
- //Tiene q buscarse el elemt si existe
6673
- //console.log('path='+path.path);
6674
- el = document.querySelector('[path=\'' + path.path + '\']');
6675
- //console.log(el);
6676
- if (el) {
6677
- var dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
6678
- //console.log(dd);
6679
- for (var i = 0; i < dd.children.length; i++) {
6680
- //Se ocultan todas las demas paginas
6681
- if (dd.children[i].style) {
6682
- if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
6683
- backPanel = dd.children[i];
6561
+ if (!key) return alert('Table don`t have defined attribute \'rowkey\'');
6562
+ var id = dat[key];
6563
+ me.MsgBox('Esta seguro que desea eliminar el registro seleccionado?', function (r) {
6564
+ if (r == 0) {
6565
+ var src = t.src.replace('/0/0', '');
6566
+ var ele = [];
6567
+ console.log(t.selected);
6568
+ var k = t.selected.length - 1;
6569
+ axios__default["default"]["delete"](src + '/' + id, {
6570
+ params: t.filters
6571
+ }).then(function () {
6572
+ console.log(t.selected);
6573
+ for (; k >= 0; k--) {
6574
+ console.log('k=' + k);
6575
+ console.log(t.data);
6576
+ console.log('t.selected[k]=' + t.selected[k]);
6577
+ dat = t.data[t.selected[k]];
6578
+ ele.push(dat);
6579
+ console.log(ele);
6580
+ t.data.splice(t.selected[k], 1);
6684
6581
  }
6685
- dd.children[i].style.display = 'none';
6686
- }
6582
+ if (me.app && me.app.toast) me.app.toast(ele.length + ' registros eliminados');else me.MsgBox(ele.length + ' registros eliminados');
6583
+ t.rowSelect(null, -1);
6584
+ t.selected = [];
6585
+ //if(cb)cb();
6586
+ })["catch"](me.error);
6587
+ //t.rowSelect(null,-1);
6687
6588
  }
6688
- el.style.removeProperty('display');
6689
- return el;
6589
+ }, ['SI', 'NO']);
6590
+ }
6591
+ },
6592
+ apiLink: function apiLink(str) {
6593
+ return str.replace(_$1.contextPath, _$1.contextPath + '/api');
6594
+ },
6595
+ open: function open(response, path, o) {
6596
+ if (!response.$el && !(response instanceof HTMLElement)) {
6597
+ var e = response;
6598
+ var t = e.target;
6599
+ var me = this;
6600
+ if (typeof e == 'string') {
6601
+ t = e;
6602
+ } else if (t.tagName == "ION-ITEM" && t.href) {
6603
+ e.preventDefault();
6604
+ t = t.href;
6690
6605
  } else {
6691
- return axios__default["default"].get((path.path + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(function (r) {
6692
- r["class"] = path["class"] ? path["class"] : '';
6693
- r.path = path.path;
6694
- r.result = path.callback;
6695
- r = Object.assign(r, path);
6696
- me.open(response, r);
6697
- })["catch"](me.error);
6606
+ e.preventDefault();
6607
+ if (!t.pathname) t = t.parentNode;
6608
+ if (!t.pathname) t = t.parentNode;
6609
+ if (!t.pathname) t = t.parentNode;
6610
+ t = t.pathname;
6698
6611
  }
6699
- }
6700
- } else if (!response.data) {
6701
- return me.open('GET', response, path);
6702
- } else if (response.data) {
6703
- path = response;
6704
- }
6705
- console.log("PATH====222");
6706
- console.log(path);
6707
- var dialog,
6708
- nid = Vue__default["default"].id(),
6709
- scriptDom = [],
6710
- for_,
6711
- ifor = 0;
6712
- if (response instanceof HTMLElement) {
6713
- dialog = response;
6714
- dialog.classList.add("v-dialog");
6715
- } else {
6716
- dialog = document.createElement("div");
6717
- dialog.classList.add("v-dialog");
6718
- dialog.innerHTML = path.data;
6719
- var s = dialog.getElementsByTagName('script');
6720
- //console.log('patttt=' + _.currentPath);
6721
- dialog.setAttribute("path", _$1.currentPath);
6722
- var ld = dialog.children;
6723
- //console.log(s);
6724
- for (var k = 0; k < s.length; k++) {
6725
- scriptDom.push(s[k]);
6726
- }
6727
- for (k = 0; k < ld.length; k++) {
6728
- //console.log(ld[k].tagName);
6729
- if (ld[k].tagName == 'V-FORM' || ld[k].tagName == 'V-PANEL') {
6730
- for_ = ld[k];
6731
- ifor = k;
6612
+ if (me.$route.path !== t) {
6613
+ console.log('path=' + t);
6614
+ me.$router.push(t);
6732
6615
  }
6616
+ return;
6733
6617
  }
6734
- }
6735
- var backPanel;
6736
- var close = function close() {
6737
- dialog.style.display = "none";
6738
- overlay = dialog.parentNode;
6739
- if (overlay.classList.contains('v-overlay')) {
6740
- //para los dialog
6741
- overlay.style.display = "none";
6742
- dialog.parentNode.removeChild(dialog);
6743
- overlay.parentNode.removeChild(overlay);
6744
- }
6745
- if (backPanel) {
6746
- dialog.parentNode.removeChild(dialog);
6747
- backPanel.style.display = 'block';
6618
+ var me = this,
6619
+ el;
6620
+ if (response.$el) {
6621
+ response = response.$el;
6622
+ path = {};
6623
+ } else if (response instanceof HTMLElement) {
6624
+ path = path && path.closeOnClickOut ? path : {};
6625
+ console.log("PATH====");
6626
+ console.log(path);
6627
+ } else if (response.target) {
6628
+ el = response.target;
6629
+ return me.open(el.pathname ? el.pathname : el.href);
6630
+ } else if (response === 'GET') {
6631
+ if (typeof path == 'string') {
6632
+ var cfg = {
6633
+ path: _$1.currentPath = path + (typeof o == 'string' ? '/' + o : '')
6634
+ };
6635
+ if (typeof o == 'function') {
6636
+ cfg.result = o;
6637
+ } else if (_typeof(o) == 'object') {
6638
+ cfg = Vue__default["default"].mergeDeep(cfg, o);
6639
+ }
6640
+ return me.open(response, cfg);
6641
+ } else if (!path.data) {
6642
+ //Tiene q buscarse el elemt si existe
6643
+ //console.log('path='+path.path);
6644
+ el = document.querySelector('[path=\'' + path.path + '\']');
6645
+ //console.log(el);
6646
+ if (el) {
6647
+ var dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
6648
+ //console.log(dd);
6649
+ for (var i = 0; i < dd.children.length; i++) {
6650
+ //Se ocultan todas las demas paginas
6651
+ if (dd.children[i].style) {
6652
+ if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
6653
+ backPanel = dd.children[i];
6654
+ }
6655
+ dd.children[i].style.display = 'none';
6656
+ }
6657
+ }
6658
+ el.style.removeProperty('display');
6659
+ return el;
6660
+ } else {
6661
+ return axios__default["default"].get((path.path + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(function (r) {
6662
+ r["class"] = path["class"] ? path["class"] : '';
6663
+ r.path = path.path;
6664
+ r.result = path.callback;
6665
+ r = Object.assign(r, path);
6666
+ me.open(response, r);
6667
+ })["catch"](me.error);
6668
+ }
6669
+ }
6670
+ } else if (!response.data) {
6671
+ return me.open('GET', response, path);
6672
+ } else if (response.data) {
6673
+ path = response;
6748
6674
  }
6749
- Vue__default["default"].resize();
6750
- };
6751
- if (for_ && for_.classList.contains('panel')) {
6752
- //Si elemto tiene declarado el id se debe considerar que es
6753
- if (for_.id) {
6754
- window.currentEl = '#' + for_.id;
6675
+ console.log("PATH====222");
6676
+ console.log(path);
6677
+ var dialog,
6678
+ nid = Vue__default["default"].id(),
6679
+ scriptDom = [],
6680
+ for_,
6681
+ ifor = 0;
6682
+ if (response instanceof HTMLElement) {
6683
+ dialog = response;
6684
+ dialog.classList.add("v-dialog");
6755
6685
  } else {
6756
- var clsId = 'cls-id-' + Vue__default["default"].id();
6757
- for_.classList.add(clsId);
6758
- window.currentEl = '.' + clsId;
6759
- }
6760
- dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
6761
- for (i = 0; i < dd.children.length; i++) {
6762
- //Se ocultan todas las demas paginas
6763
- if (dd.children[i].style) {
6764
- if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
6765
- backPanel = dd.children[i];
6686
+ dialog = document.createElement("div");
6687
+ dialog.classList.add("v-dialog");
6688
+ dialog.innerHTML = path.data;
6689
+ var s = dialog.getElementsByTagName('script');
6690
+ //console.log('patttt=' + _.currentPath);
6691
+ dialog.setAttribute("path", _$1.currentPath);
6692
+ var ld = dialog.children;
6693
+ //console.log(s);
6694
+ for (var k = 0; k < s.length; k++) {
6695
+ scriptDom.push(s[k]);
6696
+ }
6697
+ for (k = 0; k < ld.length; k++) {
6698
+ //console.log(ld[k].tagName);
6699
+ if (ld[k].tagName == 'V-FORM' || ld[k].tagName == 'V-PANEL') {
6700
+ for_ = ld[k];
6701
+ ifor = k;
6766
6702
  }
6767
- dd.children[i].style.display = 'none';
6768
6703
  }
6769
6704
  }
6770
- //se agrega el dialog recuperado y se genera
6771
- dd.appendChild(dialog);
6772
-
6773
- //console.log(scriptDom);
6774
- for (var l2 = 0; scriptDom.length > l2; l2++) {
6775
- //console.log(s[l2]);
6776
- try {
6777
- eval(scriptDom[l2].innerHTML);
6778
- } catch (e) {
6779
- console.error(e);
6705
+ var backPanel;
6706
+ var close = function close() {
6707
+ dialog.style.display = "none";
6708
+ overlay = dialog.parentNode;
6709
+ if (overlay.classList.contains('v-overlay')) {
6710
+ //para los dialog
6711
+ overlay.style.display = "none";
6712
+ dialog.parentNode.removeChild(dialog);
6713
+ overlay.parentNode.removeChild(overlay);
6780
6714
  }
6781
- }
6782
- dialog.style.display = 'none';
6783
- var td;
6784
- var aux = dialog.children[ifor];
6785
- //todo los elementos del dialog son agregados al panel
6786
- while (dialog.children.length > 0) {
6787
- if (!td) td = dialog.children[0];
6788
- dd.appendChild(dialog.children[0]);
6789
- }
6790
- dialog.parentNode.removeChild(dialog);
6791
- dialog = aux;
6792
- //console.log(path);
6793
- dialog.setAttribute("path", path.path);
6794
- } else {
6795
- var overlay = document.createElement("div");
6796
- //console.log('create overlay');
6797
- overlay.classList.add("v-overlay");
6798
- overlay.style.padding = "40px";
6799
- document.body.appendChild(overlay);
6800
- overlay.appendChild(dialog);
6801
- if (!(response instanceof HTMLElement)) {
6802
- for (l2 = 0; s.length > l2; l2++) {
6715
+ if (backPanel) {
6716
+ dialog.parentNode.removeChild(dialog);
6717
+ backPanel.style.display = 'block';
6718
+ }
6719
+ Vue__default["default"].resize();
6720
+ };
6721
+ if (for_ && for_.classList.contains('panel')) {
6722
+ //Si elemto tiene declarado el id se debe considerar que es
6723
+ if (for_.id) {
6724
+ window.currentEl = '#' + for_.id;
6725
+ } else {
6726
+ var clsId = 'cls-id-' + Vue__default["default"].id();
6727
+ for_.classList.add(clsId);
6728
+ window.currentEl = '.' + clsId;
6729
+ }
6730
+ dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
6731
+ for (i = 0; i < dd.children.length; i++) {
6732
+ //Se ocultan todas las demas paginas
6733
+ if (dd.children[i].style) {
6734
+ if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
6735
+ backPanel = dd.children[i];
6736
+ }
6737
+ dd.children[i].style.display = 'none';
6738
+ }
6739
+ }
6740
+ //se agrega el dialog recuperado y se genera
6741
+ dd.appendChild(dialog);
6742
+
6743
+ //console.log(scriptDom);
6744
+ for (var l2 = 0; scriptDom.length > l2; l2++) {
6803
6745
  //console.log(s[l2]);
6804
6746
  try {
6805
- eval(s[l2].innerHTML);
6747
+ eval(scriptDom[l2].innerHTML);
6806
6748
  } catch (e) {
6807
6749
  console.error(e);
6808
6750
  }
6809
6751
  }
6752
+ dialog.style.display = 'none';
6753
+ var td;
6754
+ var aux = dialog.children[ifor];
6755
+ //todo los elementos del dialog son agregados al panel
6756
+ while (dialog.children.length > 0) {
6757
+ if (!td) td = dialog.children[0];
6758
+ dd.appendChild(dialog.children[0]);
6759
+ }
6760
+ dialog.parentNode.removeChild(dialog);
6761
+ dialog = aux;
6762
+ //console.log(path);
6763
+ dialog.setAttribute("path", path.path);
6764
+ } else {
6765
+ var overlay = document.createElement("div");
6766
+ //console.log('create overlay');
6767
+ overlay.classList.add("v-overlay");
6768
+ overlay.style.padding = "40px";
6769
+ document.body.appendChild(overlay);
6770
+ overlay.appendChild(dialog);
6771
+ if (!(response instanceof HTMLElement)) {
6772
+ for (l2 = 0; s.length > l2; l2++) {
6773
+ //console.log(s[l2]);
6774
+ try {
6775
+ eval(s[l2].innerHTML);
6776
+ } catch (e) {
6777
+ console.error(e);
6778
+ }
6779
+ }
6780
+ }
6781
+ overlay.style.visibility = "unset";
6782
+ overlay.style.opacity = "unset";
6783
+ overlay.style.overflow = "auto";
6784
+ dialog.style.margin = "0 auto";
6785
+ dialog.style.position = "unset";
6786
+ //console.log(dialog);
6787
+ var resize = function resize(e) {
6788
+ dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
6789
+ if (window.innerWidth < 600) {
6790
+ //console.log(333333);
6791
+ console.log(dialog);
6792
+ var dc = dialog.querySelector('.v-dialog-content');
6793
+ //console.log(dc);
6794
+ var h = dialog.querySelector('.v-panel-titlebar');
6795
+ //console.log(h.clientHeight);
6796
+ var ih = window.innerHeight - 94 - (h ? h.clientHeight : 0);
6797
+ (dc ? dc : dialog).style.height = ih + "px";
6798
+ }
6799
+ };
6800
+ window.addEventListener('resize', resize);
6801
+ if (path["class"] === 'v-search') {
6802
+ var d = dialog;
6803
+ d.className = d.className + ' ' + path["class"];
6804
+ d.style.width = "100%";
6805
+ d.style.height = "calc(100% - 2px)";
6806
+ var children = d.querySelector('div');
6807
+ var f = d.querySelector('form');
6808
+ var t = d.querySelector('.v-datatable');
6809
+ var tb = d.querySelector('.v-datatable-scrollable-body');
6810
+ children.style.height = 'calc(100% - 2px)';
6811
+ children.style.overflowY = 'auto';
6812
+ children.children[1].style.padding = '0px';
6813
+ children.children[1].style.height = 'calc(100% - 33px)';
6814
+ f.style.height = '100%';
6815
+ f.style.overflowY = 'auto';
6816
+ t.style.height = 'calc(100% - 52px)';
6817
+ tb.style.height = 'calc(100% - 72px)';
6818
+ tb.style.overflowY = 'auto';
6819
+ var pag = d.querySelector('.v-paginator');
6820
+ pag.style.display = 'inline-block';
6821
+ f.appendChild(pag);
6822
+ tb = document.createElement("button");
6823
+ tb.innerHTML = 'Recuperar';
6824
+ tb.style.padding = '4px 16px';
6825
+ tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
6826
+ var vue = _$1.varMap[children.getAttribute("vueid")];
6827
+ tb.onclick = function (e) {
6828
+ e.preventDefault();
6829
+ vue.refresh();
6830
+ };
6831
+ f.appendChild(tb);
6832
+ tb = document.createElement("button");
6833
+ tb.innerHTML = 'Seleccionar';
6834
+ tb.style.padding = '4px 16px';
6835
+ tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
6836
+ vue = _$1.varMap[children.getAttribute("vueid")];
6837
+ tb.onclick = function (e) {
6838
+ e.preventDefault();
6839
+ var d = [];
6840
+ var t = vue.$children[0].$children[0];
6841
+ for (i = 0; i < t.selected.length; i++) {
6842
+ d.push(t.filteredData[t.selected[i]]);
6843
+ }
6844
+ path.result(d);
6845
+ delete path.result;
6846
+ vue.close(e);
6847
+ };
6848
+ f.appendChild(tb);
6849
+ }
6850
+ resize();
6810
6851
  }
6811
- overlay.style.visibility = "unset";
6812
- overlay.style.opacity = "unset";
6813
- overlay.style.overflow = "auto";
6814
- dialog.style.margin = "0 auto";
6815
- dialog.style.position = "unset";
6816
- //console.log(dialog);
6817
- var resize = function resize(e) {
6818
- dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
6819
- if (window.innerWidth < 600) {
6820
- //console.log(333333);
6821
- console.log(dialog);
6822
- var dc = dialog.querySelector('.v-dialog-content');
6823
- //console.log(dc);
6824
- var h = dialog.querySelector('.v-panel-titlebar');
6825
- //console.log(h.clientHeight);
6826
- var ih = window.innerHeight - 94 - (h ? h.clientHeight : 0);
6827
- (dc ? dc : dialog).style.height = ih + "px";
6852
+ _$1.storeFunction['PROPS=' + nid] = path;
6853
+ _$1.storeFunction[nid] = function (o) {
6854
+ if (path.result) {
6855
+ path.result(o);
6828
6856
  }
6857
+ if (o === true) me.refresh();
6829
6858
  };
6830
- window.addEventListener('resize', resize);
6831
- if (path["class"] === 'v-search') {
6832
- var d = dialog;
6833
- d.className = d.className + ' ' + path["class"];
6834
- d.style.width = "100%";
6835
- d.style.height = "calc(100% - 2px)";
6836
- var children = d.querySelector('div');
6837
- var f = d.querySelector('form');
6838
- var t = d.querySelector('.v-datatable');
6839
- var tb = d.querySelector('.v-datatable-scrollable-body');
6840
- children.style.height = 'calc(100% - 2px)';
6841
- children.style.overflowY = 'auto';
6842
- children.children[1].style.padding = '0px';
6843
- children.children[1].style.height = 'calc(100% - 33px)';
6844
- f.style.height = '100%';
6845
- f.style.overflowY = 'auto';
6846
- t.style.height = 'calc(100% - 52px)';
6847
- tb.style.height = 'calc(100% - 72px)';
6848
- tb.style.overflowY = 'auto';
6849
- var pag = d.querySelector('.v-paginator');
6850
- pag.style.display = 'inline-block';
6851
- f.appendChild(pag);
6852
- tb = document.createElement("button");
6853
- tb.innerHTML = 'Recuperar';
6854
- tb.style.padding = '4px 16px';
6855
- tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
6856
- var vue = _$1.varMap[children.getAttribute("vueid")];
6857
- tb.onclick = function (e) {
6858
- e.preventDefault();
6859
- vue.refresh();
6860
- };
6861
- f.appendChild(tb);
6862
- tb = document.createElement("button");
6863
- tb.innerHTML = 'Seleccionar';
6864
- tb.style.padding = '4px 16px';
6865
- tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
6866
- vue = _$1.varMap[children.getAttribute("vueid")];
6867
- tb.onclick = function (e) {
6868
- e.preventDefault();
6869
- var d = [];
6870
- var t = vue.$children[0].$children[0];
6871
- for (i = 0; i < t.selected.length; i++) {
6872
- d.push(t.filteredData[t.selected[i]]);
6859
+ var _vue_ = dialog.querySelector('[vueid]');
6860
+ if (_vue_) {
6861
+ path.__vue__ = _vue_.__vue__;
6862
+ _vue_.__vue__.$emit('opened', path);
6863
+ }
6864
+ dialog.setAttribute("callback", nid);
6865
+ var h = dialog.querySelector('.v-panel-titlebar');
6866
+ if (h) {
6867
+ var acl = h.querySelector('.ui-js-close');
6868
+ window.onkeyup = function (event) {
6869
+ if (event.keyCode == 27) {
6870
+ close();
6873
6871
  }
6874
- path.result(d);
6875
- delete path.result;
6876
- vue.close(e);
6877
6872
  };
6878
- f.appendChild(tb);
6873
+ if (!acl) {
6874
+ var span = document.createElement("i");
6875
+ span.style.top = "6px";
6876
+ span.style.right = "6px";
6877
+ h.style.position = "relative";
6878
+ span.style.position = "absolute";
6879
+ span.style.color = "white";
6880
+ span.className = "fa fa-window-close v-dialog-close";
6881
+ acl = document.createElement("a");
6882
+ acl.className = "ui-js-close v-dialog-titlebar-icon v-dialog-titlebar-close ui-corner-all";
6883
+ acl.appendChild(span);
6884
+ h.appendChild(acl);
6885
+ acl.addEventListener("click", close);
6886
+ }
6879
6887
  }
6880
- resize();
6881
- }
6882
- _$1.storeFunction['PROPS=' + nid] = path;
6883
- _$1.storeFunction[nid] = function (o) {
6884
- if (path.result) {
6885
- path.result(o);
6888
+ if (path.closeOnClickOut) {
6889
+ dialog.parentNode.addEventListener("click", close);
6886
6890
  }
6887
- if (o === true) me.refresh();
6888
- };
6889
- var _vue_ = dialog.querySelector('[vueid]');
6890
- if (_vue_) {
6891
- path.__vue__ = _vue_.__vue__;
6892
- _vue_.__vue__.$emit('opened', path);
6893
- }
6894
- dialog.setAttribute("callback", nid);
6895
- var h = dialog.querySelector('.v-panel-titlebar');
6896
- if (h) {
6897
- var acl = h.querySelector('.ui-js-close');
6898
- window.onkeyup = function (event) {
6899
- if (event.keyCode == 27) {
6900
- close();
6901
- }
6902
- };
6903
- if (!acl) {
6904
- var span = document.createElement("i");
6905
- span.style.top = "6px";
6906
- span.style.right = "6px";
6907
- h.style.position = "relative";
6908
- span.style.position = "absolute";
6909
- span.style.color = "white";
6910
- span.className = "fa fa-window-close v-dialog-close";
6911
- acl = document.createElement("a");
6912
- acl.className = "ui-js-close v-dialog-titlebar-icon v-dialog-titlebar-close ui-corner-all";
6913
- acl.appendChild(span);
6914
- h.appendChild(acl);
6915
- acl.addEventListener("click", close);
6891
+ dialog.style.display = 'block';
6892
+ Vue__default["default"].resize();
6893
+ document.documentElement.style.overflow = 'hidden'; // firefox, chrome
6894
+ document.body.scroll = "no"; // ie only
6895
+ },
6896
+ close: function close(ok) {
6897
+ if (ok.$el) ok = ok.$el;
6898
+ var dlg = ok instanceof HTMLElement ? ok : null;
6899
+ try {
6900
+ if (!dlg && event.target instanceof HTMLElement) dlg = _$1.closest(event.target, '.v-dialog');
6901
+ } catch (e) {
6902
+ console.log(e);
6916
6903
  }
6917
- }
6918
- if (path.closeOnClickOut) {
6919
- dialog.parentNode.addEventListener("click", close);
6920
- }
6921
- dialog.style.display = 'block';
6922
- Vue__default["default"].resize();
6923
- document.documentElement.style.overflow = 'hidden'; // firefox, chrome
6924
- document.body.scroll = "no"; // ie only
6925
- },
6926
- close: function close(ok) {
6927
- if (ok.$el) ok = ok.$el;
6928
- var dlg = ok instanceof HTMLElement ? ok : null;
6929
- try {
6930
- if (!dlg && event.target instanceof HTMLElement) dlg = _$1.closest(event.target, '.v-dialog');
6931
- } catch (e) {
6932
- console.log(e);
6933
- }
6934
- if (!dlg) dlg = this.$el.parentElement;
6935
- var mask = dlg.parentElement;
6936
- if (!mask && _$1.app.$router) {
6937
- _$1.app.$router.back();
6938
- return;
6939
- }
6940
- dlg.style.display = "none";
6941
- if ((' ' + mask.className + ' ').indexOf(' v-overlay ') > -1) mask.style.display = "none";else mask = null;
6942
- Vue__default["default"].resize();
6943
- var cb = _$1.storeFunction[dlg.getAttribute("callback")];
6944
- if (cb) cb(ok);
6945
- dlg.parentNode.removeChild(dlg);
6946
- if (mask) mask.parentNode.removeChild(mask);
6947
- document.documentElement.style.overflow = 'auto'; // firefox, chrome
6948
- document.body.scroll = "yes";
6949
- //si history esta activo
6950
- //history.back();
6951
- },
6952
- refresh: function refresh() {
6953
- //Para que funcione se debe tener el listado respetando la estructura
6954
- var me = this;
6955
- var t = me.$children[0].$children[0];
6956
- t.load();
6957
- },
6958
- removeStored: function removeStored(storage) {
6959
- if (window.idb) {
6960
- var me = this,
6961
- db = window._.db,
6962
- objectStore = db.transaction([storage], "readwrite").objectStore(storage);
6963
- var objectStoreRequest = objectStore.clear();
6964
- objectStoreRequest.onerror = function () {
6965
- me.MsgBox('Error al eliminar data temporal');
6966
- };
6967
- } else {
6968
- localStorage.removeItem(storage);
6969
- }
6970
- },
6971
- toast: function toast(msx, callback) {
6972
- try {
6973
- var _this2 = this;
6974
- if (msx.message && !msx.duration) msx.duration = 2000;
6975
- return _await(_this2.$ionic.toastController.create(msx.message ? msx : {
6976
- message: msx,
6977
- duration: 2000
6978
- }), function (toast) {
6979
- return _await(toast.present(), function () {
6980
- if (callback) callback();
6904
+ if (!dlg) dlg = this.$el.parentElement;
6905
+ var mask = dlg.parentElement;
6906
+ if (!mask && _$1.app.$router) {
6907
+ _$1.app.$router.back();
6908
+ return;
6909
+ }
6910
+ dlg.style.display = "none";
6911
+ if ((' ' + mask.className + ' ').indexOf(' v-overlay ') > -1) mask.style.display = "none";else mask = null;
6912
+ Vue__default["default"].resize();
6913
+ var cb = _$1.storeFunction[dlg.getAttribute("callback")];
6914
+ if (cb) cb(ok);
6915
+ dlg.parentNode.removeChild(dlg);
6916
+ if (mask) mask.parentNode.removeChild(mask);
6917
+ document.documentElement.style.overflow = 'auto'; // firefox, chrome
6918
+ document.body.scroll = "yes";
6919
+ //si history esta activo
6920
+ //history.back();
6921
+ },
6922
+ refresh: function refresh() {
6923
+ //Para que funcione se debe tener el listado respetando la estructura
6924
+ var me = this;
6925
+ var t = me.$children[0].$children[0];
6926
+ t.load();
6927
+ },
6928
+ removeStored: function removeStored(storage) {
6929
+ if (window.idb) {
6930
+ var me = this,
6931
+ db = window._.db,
6932
+ objectStore = db.transaction([storage], "readwrite").objectStore(storage);
6933
+ var objectStoreRequest = objectStore.clear();
6934
+ objectStoreRequest.onerror = function () {
6935
+ me.MsgBox('Error al eliminar data temporal');
6936
+ };
6937
+ } else {
6938
+ localStorage.removeItem(storage);
6939
+ }
6940
+ },
6941
+ toast: function toast(msx, callback) {
6942
+ try {
6943
+ var _this2 = this;
6944
+ if (msx.message && !msx.duration) msx.duration = 2000;
6945
+ return _await(_this2.$ionic.toastController.create(msx.message ? msx : {
6946
+ message: msx,
6947
+ duration: 2000
6948
+ }), function (toast) {
6949
+ return _await(toast.present(), function () {
6950
+ if (callback) callback();
6951
+ });
6981
6952
  });
6982
- });
6983
- } catch (e) {
6984
- return Promise.reject(e);
6985
- }
6986
- },
6987
- setStoredList: function setStoredList(store, data) {
6988
- try {
6989
- var db, objectStore;
6990
- if (_$1.db) {
6991
- try {
6992
- db = _$1.db;
6993
- objectStore = db.transaction([store], "readwrite").objectStore(store);
6994
- var objectStoreRequest = objectStore.clear();
6995
- objectStoreRequest.onsuccess = function () {
6996
- for (var i in data) {
6997
- console.log(data[i]);
6998
- var request = objectStore.add(data[i]);
6999
- request.onerror = function (event) {
7000
- console.log(event);
7001
- };
7002
- }
7003
- };
7004
- } catch (e) {
7005
- alert(store);
7006
- throw e;
6953
+ } catch (e) {
6954
+ return Promise.reject(e);
6955
+ }
6956
+ },
6957
+ setStoredList: function setStoredList(store, data) {
6958
+ try {
6959
+ var db, objectStore;
6960
+ if (_$1.db) {
6961
+ try {
6962
+ db = _$1.db;
6963
+ objectStore = db.transaction([store], "readwrite").objectStore(store);
6964
+ var objectStoreRequest = objectStore.clear();
6965
+ objectStoreRequest.onsuccess = function () {
6966
+ for (var i in data) {
6967
+ console.log(data[i]);
6968
+ var request = objectStore.add(data[i]);
6969
+ request.onerror = function (event) {
6970
+ console.log(event);
6971
+ };
6972
+ }
6973
+ };
6974
+ } catch (e) {
6975
+ alert(store);
6976
+ throw e;
6977
+ }
6978
+ } else {
6979
+ localStorage.setItem(store, JSON.stringify(data));
7007
6980
  }
7008
- } else {
7009
- localStorage.setItem(store, JSON.stringify(data));
6981
+ return _await();
6982
+ } catch (e) {
6983
+ return Promise.reject(e);
7010
6984
  }
7011
- return _await();
7012
- } catch (e) {
7013
- return Promise.reject(e);
7014
- }
7015
- },
7016
- getStoredList: function getStoredList(store, params) {
7017
- try {
7018
- var _exit = false;
7019
- var loadedStores;
6985
+ },
6986
+ getStoredList: function getStoredList(store, params) {
7020
6987
  try {
7021
- loadedStores = JSON.parse(sessionStorage.getItem('loadedStores'));
7022
- } catch (e) {}
7023
- if (loadedStores == null) loadedStores = {};
7024
- //console.log(loadedStores);
7025
- return _await(_invoke(function () {
7026
- if (!loadedStores[store] && _$1.networkStatus.connected) {
7027
- var e = _$1.stores.filter(function (e) {
7028
- return e[0] == store;
7029
- })[0];
7030
- //console.log(e);
7031
- if (!e[2]) throw "store url is empty";
7032
- return _await(axios__default["default"].get(e[2]), function (data) {
7033
- var objectStore = _$1.db.transaction([e[0]], "readwrite").objectStore(e[0]);
7034
- return _await(objectStore.clear(), function () {
7035
- var _exit2 = false;
7036
- data = data.data || data;
7037
- return _continue(_forIn(data, function (i) {
7038
- return _catch(function () {
7039
- return _awaitIgnored(objectStore.add(data[i]));
7040
- }, function (exception) {
7041
- //console.log(data[i]);
7042
- //console.log(e[0]);
7043
- throw exception;
6988
+ var _exit = false;
6989
+ var loadedStores;
6990
+ try {
6991
+ loadedStores = JSON.parse(sessionStorage.getItem('loadedStores'));
6992
+ } catch (e) {}
6993
+ if (loadedStores == null) loadedStores = {};
6994
+ //console.log(loadedStores);
6995
+ return _await(_invoke(function () {
6996
+ if (!loadedStores[store] && _$1.networkStatus.connected) {
6997
+ var e = _$1.stores.filter(function (e) {
6998
+ return e[0] == store;
6999
+ })[0];
7000
+ //console.log(e);
7001
+ if (!e[2]) throw "store url is empty";
7002
+ return _await(axios__default["default"].get(e[2]), function (data) {
7003
+ var objectStore = _$1.db.transaction([e[0]], "readwrite").objectStore(e[0]);
7004
+ return _await(objectStore.clear(), function () {
7005
+ var _exit2 = false;
7006
+ data = data.data || data;
7007
+ return _continue(_forIn(data, function (i) {
7008
+ return _catch(function () {
7009
+ return _awaitIgnored(objectStore.add(data[i]));
7010
+ }, function (exception) {
7011
+ //console.log(data[i]);
7012
+ //console.log(e[0]);
7013
+ throw exception;
7014
+ });
7015
+ }, function () {
7016
+ return _exit2;
7017
+ }), function (_result3) {
7018
+ if (_exit2) ;
7019
+ loadedStores[store] = 1;
7020
+ sessionStorage.setItem('loadedStores', JSON.stringify(loadedStores));
7044
7021
  });
7045
- }, function () {
7046
- return _exit2;
7047
- }), function (_result3) {
7048
- if (_exit2) ;
7049
- loadedStores[store] = 1;
7050
- sessionStorage.setItem('loadedStores', JSON.stringify(loadedStores));
7051
7022
  });
7052
7023
  });
7024
+ }
7025
+ }, function (_result) {
7026
+ if (_exit) return _result;
7027
+ var p = new Promise(function (resolve, rejected) {
7028
+ if (_$1.db) {
7029
+ var t = _$1.db.transaction(store),
7030
+ objectStore = t.objectStore(store); //,d=[];
7031
+ var r = objectStore.getAll();
7032
+ r.onsuccess = function () {
7033
+ resolve(r.result);
7034
+ };
7035
+ } else rejected('db is null');
7036
+ //t.onerror = event => reject(event.target.error);
7053
7037
  });
7054
- }
7055
- }, function (_result) {
7056
- if (_exit) return _result;
7057
- var p = new Promise(function (resolve, rejected) {
7058
- if (_$1.db) {
7059
- var t = _$1.db.transaction(store),
7060
- objectStore = t.objectStore(store); //,d=[];
7061
- var r = objectStore.getAll();
7062
- r.onsuccess = function () {
7063
- resolve(r.result);
7064
- };
7065
- } else rejected('db is null');
7066
- //t.onerror = event => reject(event.target.error);
7067
- });
7068
- return _await(p); //console.log(result);
7069
- }));
7070
- } catch (e) {
7071
- return Promise.reject(e);
7072
- }
7073
- },
7074
- getStoreObject: function getStoreObject(storage, id) {
7075
- var db = window._.db,
7076
- objectStore = db.transaction([storage], "readwrite").objectStore(storage);
7077
- return objectStore.get(id);
7078
- },
7079
- sync: function sync(e) {
7080
- try {
7081
- var _this3 = this;
7082
- var me = _this3;
7083
- var p = me.$el;
7084
- var f = p.querySelector("form");
7085
- var action = f.getAttribute('action');
7086
- //console.log('Action='+action);
7087
- if (!action) {
7088
- action = me.$el.parentNode.getAttribute('path');
7089
- //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
7090
- var tc = action.split('/');
7091
- if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
7092
- action = me.apiLink(tc.join('/'));
7038
+ return _await(p); //console.log(result);
7039
+ }));
7040
+ } catch (e) {
7041
+ return Promise.reject(e);
7093
7042
  }
7094
- var t = me.$children[0].$children[0];
7095
- action = t.src;
7096
- //debe recorrerse toda los registros seleccionados
7097
- //ponerlos gris
7098
- return _await(me.getStoredList(t.store), function (dats) {
7099
- var sel = t.selected;
7100
- var sel2 = [];
7101
- var sel3 = [];
7102
- for (var i = 0; i < sel.length; i++) {
7103
- //se recupra
7104
- var item = t.data[sel[i]];
7105
- if (item.tmpId && !item["synchronized"]) {
7106
- for (var j = 0; j < dats.length; j++) {
7107
- if (dats[j].tmpId == item.tmpId) {
7108
- var o = JSON.clone(dats[j]);
7109
- delete o["synchronized"];
7110
- sel3.push(o);
7111
- sel2.push(j);
7043
+ },
7044
+ getStoreObject: function getStoreObject(storage, id) {
7045
+ var db = window._.db,
7046
+ objectStore = db.transaction([storage], "readwrite").objectStore(storage);
7047
+ return objectStore.get(id);
7048
+ },
7049
+ sync: function sync(e) {
7050
+ try {
7051
+ var _this3 = this;
7052
+ var me = _this3;
7053
+ var p = me.$el;
7054
+ var f = p.querySelector("form");
7055
+ var action = f.getAttribute('action');
7056
+ //console.log('Action='+action);
7057
+ if (!action) {
7058
+ action = me.$el.parentNode.getAttribute('path');
7059
+ //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
7060
+ var tc = action.split('/');
7061
+ if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
7062
+ action = me.apiLink(tc.join('/'));
7063
+ }
7064
+ var t = me.$children[0].$children[0];
7065
+ action = t.src;
7066
+ //debe recorrerse toda los registros seleccionados
7067
+ //ponerlos gris
7068
+ return _await(me.getStoredList(t.store), function (dats) {
7069
+ var sel = t.selected;
7070
+ var sel2 = [];
7071
+ var sel3 = [];
7072
+ for (var i = 0; i < sel.length; i++) {
7073
+ //se recupra
7074
+ var item = t.data[sel[i]];
7075
+ if (item.tmpId && !item["synchronized"]) {
7076
+ for (var j = 0; j < dats.length; j++) {
7077
+ if (dats[j].tmpId == item.tmpId) {
7078
+ var o = JSON.clone(dats[j]);
7079
+ delete o["synchronized"];
7080
+ sel3.push(o);
7081
+ sel2.push(j);
7082
+ }
7112
7083
  }
7113
7084
  }
7114
7085
  }
7115
- }
7116
- //se envia solo los selccionados
7117
- if (sel2.length > 0) {
7118
- axios__default["default"].post(action + '/bulk' + (e.sufix ? e.sufix : ''), sel3).then(function (r) {
7119
- var d = r.data;
7120
- //console.log(d);
7121
- for (var k = 0; k < d.length; k++) {
7122
- if (d[k].errors) {
7123
- me.MsgBox(JSON.stringify(d[k].errors));
7124
- break;
7125
- }
7126
- if (d[k].error) {
7127
- me.MsgBox(d[k].error);
7128
- break;
7129
- }
7130
- for (var j = 0; j < dats.length; j++) {
7131
- //cada registro recibido de bulk ss compara con los locales
7132
- if (d[k].ext && d[k].ext.tmpId == dats[j].tmpId || d[k].tmpId == dats[j].tmpId) {
7133
- console.log('ok');
7134
- if (d[k].ext && dats.ext) {
7135
- dats[j].ext.error = d[k].ext.error;
7086
+ //se envia solo los selccionados
7087
+ if (sel2.length > 0) {
7088
+ axios__default["default"].post(action + '/bulk' + (e.sufix ? e.sufix : ''), sel3).then(function (r) {
7089
+ var d = r.data;
7090
+ //console.log(d);
7091
+ for (var k = 0; k < d.length; k++) {
7092
+ if (d[k].errors) {
7093
+ me.MsgBox(JSON.stringify(d[k].errors));
7094
+ break;
7095
+ }
7096
+ if (d[k].error) {
7097
+ me.MsgBox(d[k].error);
7098
+ break;
7099
+ }
7100
+ for (var j = 0; j < dats.length; j++) {
7101
+ //cada registro recibido de bulk ss compara con los locales
7102
+ if (d[k].ext && d[k].ext.tmpId == dats[j].tmpId || d[k].tmpId == dats[j].tmpId) {
7103
+ console.log('ok');
7104
+ if (d[k].ext && dats.ext) {
7105
+ dats[j].ext.error = d[k].ext.error;
7106
+ }
7107
+ if (d[k].id) dats[j].id = d[k].id;
7108
+ //aqui deberia revisarsee los registro anidados
7109
+ dats[j]["synchronized"] = 1;
7110
+ me.$emit('sync', d[k], dats[j]);
7136
7111
  }
7137
- if (d[k].id) dats[j].id = d[k].id;
7138
- //aqui deberia revisarsee los registro anidados
7139
- dats[j]["synchronized"] = 1;
7140
- me.$emit('sync', d[k], dats[j]);
7141
7112
  }
7142
7113
  }
7143
- }
7144
- me.setStoredList(t.store, dats);
7145
- //dat.id=r.data.id;
7146
- //t.$emit('synchronized',{data:dat,result:r.data,index:kk,count:tr});
7147
- //dat.synchronized=1;
7148
- //dats[kk]=dat;
7149
- //sendf(dats,k0+1,te+1);
7150
- me.refresh();
7151
- })["catch"](function (r) {
7152
- if (r.response) {
7153
- me.MsgBox(r.response.data);
7154
- } else {
7155
- console.log(r);
7156
- }
7157
- });
7158
- }
7159
- });
7160
- } catch (e) {
7161
- return Promise.reject(e);
7162
- }
7163
- },
7164
- save: function save() {
7165
- try {
7166
- var _this4 = this;
7167
- var me = _this4;
7168
- me.$forceUpdate();
7169
- var p = me.$el;
7170
- //Se debe buscar si abajo esta el form
7171
- var f = p.querySelector("form");
7172
- var va = _this4.validate(f);
7173
- return _await(function () {
7174
- if (va) {
7175
- var action = f.getAttribute('action');
7176
- //console.log('Action='+action);
7177
- if (!action) {
7178
- action = me.$el.parentNode.getAttribute('path');
7179
- if (action) {
7180
- //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
7181
- var tc = action.split('/');
7182
- if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
7183
- action = me.apiLink(tc.join('/'));
7184
- }
7114
+ me.setStoredList(t.store, dats);
7115
+ //dat.id=r.data.id;
7116
+ //t.$emit('synchronized',{data:dat,result:r.data,index:kk,count:tr});
7117
+ //dat.synchronized=1;
7118
+ //dats[kk]=dat;
7119
+ //sendf(dats,k0+1,te+1);
7120
+ me.refresh();
7121
+ })["catch"](function (r) {
7122
+ if (r.response) {
7123
+ me.MsgBox(r.response.data);
7124
+ } else {
7125
+ console.log(r);
7126
+ }
7127
+ });
7185
7128
  }
7186
- var o0 = _this4._data.data ? _this4._data.data : _this4._data.o;
7187
- var o = JSON.parse(JSON.stringify(o0));
7188
- if (me.process) o = me.process(o);
7189
- //console.log('o2='+o);
7190
- if (!(_typeof(o) === 'object' && !Array.isArray(o) && o !== null)) return;
7191
- return function () {
7192
- if (!action || !me.app.networkStatus.connected) {
7193
- var store = me.$children[0].store;
7194
- if (!store) {
7195
- me.MsgBox('Store in form is undefined!');
7196
- return;
7129
+ });
7130
+ } catch (e) {
7131
+ return Promise.reject(e);
7132
+ }
7133
+ },
7134
+ save: function save() {
7135
+ try {
7136
+ var _this4 = this;
7137
+ var me = _this4;
7138
+ me.$forceUpdate();
7139
+ var p = me.$el;
7140
+ //Se debe buscar si abajo esta el form
7141
+ var f = p.querySelector("form");
7142
+ var va = _this4.validate(f);
7143
+ return _await(function () {
7144
+ if (va) {
7145
+ var action = f.getAttribute('action');
7146
+ //console.log('Action='+action);
7147
+ if (!action) {
7148
+ action = me.$el.parentNode.getAttribute('path');
7149
+ if (action) {
7150
+ //debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
7151
+ var tc = action.split('/');
7152
+ if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
7153
+ action = me.apiLink(tc.join('/'));
7197
7154
  }
7198
- return _await(me.getStoredList(store), function (storedList) {
7199
- if (!storedList) storedList = [];
7200
- if (o.id) {
7201
- for (var k = 0; k < storedList.length; k++) {
7202
- if (storedList[k].tmpId == o.tmpId) {
7203
- delete o["synchronized"];
7204
- storedList[k] = o;
7155
+ }
7156
+ var o0 = _this4._data.data ? _this4._data.data : _this4._data.o;
7157
+ var o = JSON.parse(JSON.stringify(o0));
7158
+ if (me.process) o = me.process(o);
7159
+ //console.log('o2='+o);
7160
+ if (!(_typeof(o) === 'object' && !Array.isArray(o) && o !== null)) return;
7161
+ return function () {
7162
+ if (!action || !me.app.networkStatus.connected) {
7163
+ var store = me.$children[0].store;
7164
+ if (!store) {
7165
+ me.MsgBox('Store in form is undefined!');
7166
+ return;
7167
+ }
7168
+ return _await(me.getStoredList(store), function (storedList) {
7169
+ if (!storedList) storedList = [];
7170
+ if (o.id) {
7171
+ for (var k = 0; k < storedList.length; k++) {
7172
+ if (storedList[k].tmpId == o.tmpId) {
7173
+ delete o["synchronized"];
7174
+ storedList[k] = o;
7175
+ }
7205
7176
  }
7206
7177
  }
7207
- }
7208
- var db = _$1.db;
7209
- var transaction = db.transaction([store], "readwrite");
7210
- var objectStore = transaction.objectStore(store);
7211
- if (!o.id) {
7212
- o.tmpId = 1 * new Date();
7213
- o.id = -o.tmpId;
7214
- //add new item to start to array
7215
- var objectStoreRequest = objectStore.add(o);
7216
- objectStoreRequest.onsuccess = function (e) {
7217
- console.log(e);
7218
- console.log('saved to ' + store);
7219
- storedList.unshift(o);
7220
- me.$emit('stored', o, storedList, objectStore);
7221
- if (me.app && me.app.toast) me.app.toast('El registro fue grabado exitosamente!');
7222
- o0.tmpId = o.tmpId;
7223
- o0.id = o.id;
7224
- me.close({
7225
- success: true,
7226
- data: o
7227
- });
7228
- };
7229
- objectStoreRequest.onerror = function (e) {
7230
- if (me.app && me.app.toast) me.app.toast('Error!');
7231
- console.log(e);
7232
- };
7233
- } else {
7234
- delete o["synchronized"];
7235
- var item = objectStore.get(o.tmpId);
7236
- item.onsuccess = function () {
7237
- console.log(item.result);
7238
- if (item.result) {
7239
- console.log('objectStore.put(o)');
7240
- objectStore.put(o);
7241
- } else {
7242
- storedList.forEach(function (ee) {
7243
- if (ee.tmpId == o.tmpId) {
7244
- objectStore.put(o);
7245
- }
7178
+ var db = _$1.db;
7179
+ var transaction = db.transaction([store], "readwrite");
7180
+ var objectStore = transaction.objectStore(store);
7181
+ if (!o.id) {
7182
+ o.tmpId = 1 * new Date();
7183
+ o.id = -o.tmpId;
7184
+ //add new item to start to array
7185
+ var objectStoreRequest = objectStore.add(o);
7186
+ objectStoreRequest.onsuccess = function (e) {
7187
+ console.log(e);
7188
+ console.log('saved to ' + store);
7189
+ storedList.unshift(o);
7190
+ me.$emit('stored', o, storedList, objectStore);
7191
+ if (me.app && me.app.toast) me.app.toast('El registro fue grabado exitosamente!');
7192
+ o0.tmpId = o.tmpId;
7193
+ o0.id = o.id;
7194
+ me.close({
7195
+ success: true,
7196
+ data: o
7246
7197
  });
7247
- }
7248
- me.$emit('stored', o, storedList, objectStore);
7249
- if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!');
7250
- me.close({
7251
- success: true,
7252
- data: o
7253
- });
7254
- };
7255
- item.onerror = function () {
7256
- me.MsgBox('Error getting temporal record ' + o.tmpId);
7257
- };
7258
- }
7259
- });
7260
- } else {
7261
- axios__default["default"].post(action, o).then(function (result) {
7262
- var data = result.data;
7263
- if (o.tmpId) {
7264
- var store = me.$children[0].store;
7265
- var objectStore = window._.db.transaction([store], "readwrite").objectStore(store);
7266
- var item = objectStore.get(o.tmpId);
7267
- if (data.id) {
7268
- o.id = data.id;
7269
- o0.id = o.id;
7198
+ };
7199
+ objectStoreRequest.onerror = function (e) {
7200
+ if (me.app && me.app.toast) me.app.toast('Error!');
7201
+ console.log(e);
7202
+ };
7203
+ } else {
7204
+ delete o["synchronized"];
7205
+ var item = objectStore.get(o.tmpId);
7206
+ item.onsuccess = function () {
7207
+ console.log(item.result);
7208
+ if (item.result) {
7209
+ console.log('objectStore.put(o)');
7210
+ objectStore.put(o);
7211
+ } else {
7212
+ storedList.forEach(function (ee) {
7213
+ if (ee.tmpId == o.tmpId) {
7214
+ objectStore.put(o);
7215
+ }
7216
+ });
7217
+ }
7218
+ me.$emit('stored', o, storedList, objectStore);
7219
+ if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!');
7220
+ me.close({
7221
+ success: true,
7222
+ data: o
7223
+ });
7224
+ };
7225
+ item.onerror = function () {
7226
+ me.MsgBox('Error getting temporal record ' + o.tmpId);
7227
+ };
7270
7228
  }
7271
- item.onsuccess = function () {
7272
- o0["synchronized"] = 1;
7273
- o["synchronized"] = 1;
7274
- var re;
7275
- if (item.result) {
7276
- re = objectStore.put(o);
7277
- } else {
7278
- re = objectStore.add(o);
7229
+ });
7230
+ } else {
7231
+ axios__default["default"].post(action, o).then(function (result) {
7232
+ var data = result.data;
7233
+ if (o.tmpId) {
7234
+ var store = me.$children[0].store;
7235
+ var objectStore = window._.db.transaction([store], "readwrite").objectStore(store);
7236
+ var item = objectStore.get(o.tmpId);
7237
+ if (data.id) {
7238
+ o.id = data.id;
7239
+ o0.id = o.id;
7279
7240
  }
7280
- re.onerror = function (e) {
7281
- console.error(e);
7241
+ item.onsuccess = function () {
7242
+ o0["synchronized"] = 1;
7243
+ o["synchronized"] = 1;
7244
+ var re;
7245
+ if (item.result) {
7246
+ re = objectStore.put(o);
7247
+ } else {
7248
+ re = objectStore.add(o);
7249
+ }
7250
+ re.onerror = function (e) {
7251
+ console.error(e);
7252
+ };
7253
+ //data es l valor recibiddo y o l nviao
7254
+ me.$emit('sync', data, o);
7282
7255
  };
7283
- //data es l valor recibiddo y o l nviao
7284
- me.$emit('sync', data, o);
7285
- };
7286
- item.onerror = function () {
7287
- me.MsgBox('Error getting temporal record ' + o.tmpId);
7288
- };
7289
- }
7290
- if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!', function () {
7291
- me.close({
7292
- success: true,
7293
- data: data
7294
- });
7295
- });else {
7296
- console.log(data);
7297
- me.MsgBox('El registro fue grabado exitosamente!', function () {
7256
+ item.onerror = function () {
7257
+ me.MsgBox('Error getting temporal record ' + o.tmpId);
7258
+ };
7259
+ }
7260
+ if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!', function () {
7298
7261
  me.close({
7299
7262
  success: true,
7300
7263
  data: data
7301
7264
  });
7302
- });
7303
- }
7304
- })["catch"](function (r) {
7305
- console.log(r);
7306
- if (r.response) {
7307
- var l, e;
7308
- if (typeof r.response.data === 'string') {
7309
- me.MsgBox(r.response.data);
7310
- } else {
7311
- l = r.response.data.propertyViolations;
7312
- //ec += l.length;
7313
- for (var i = 0; i < l.length; i++) {
7314
- var t = l[i];
7315
- e = f.querySelector('[name=' + t.path + ']');
7316
- if (e) {
7317
- me.showerror(e, t.message);
7265
+ });else {
7266
+ console.log(data);
7267
+ me.MsgBox('El registro fue grabado exitosamente!', function () {
7268
+ me.close({
7269
+ success: true,
7270
+ data: data
7271
+ });
7272
+ });
7273
+ }
7274
+ })["catch"](function (r) {
7275
+ console.log(r);
7276
+ if (r.response) {
7277
+ var l, e;
7278
+ if (typeof r.response.data === 'string') {
7279
+ me.MsgBox(r.response.data);
7280
+ } else {
7281
+ l = r.response.data.propertyViolations;
7282
+ //ec += l.length;
7283
+ for (var i = 0; i < l.length; i++) {
7284
+ var t = l[i];
7285
+ e = f.querySelector('[name=' + t.path + ']');
7286
+ if (e) {
7287
+ me.showerror(e, t.message);
7288
+ }
7318
7289
  }
7319
- }
7320
- l = r.response.data.fieldViolations;
7321
- //ec += l.length;
7322
- for (i = 0; i < l.length; i++) {
7323
- t = l[i];
7324
- e = f.querySelector('[name=' + t.path + ']');
7325
- if (e) {
7326
- me.showerror(e, t.message + ', valor=' + t.value);
7290
+ l = r.response.data.fieldViolations;
7291
+ //ec += l.length;
7292
+ for (i = 0; i < l.length; i++) {
7293
+ t = l[i];
7294
+ e = f.querySelector('[name=' + t.path + ']');
7295
+ if (e) {
7296
+ me.showerror(e, t.message + ', valor=' + t.value);
7297
+ }
7327
7298
  }
7299
+ me.MsgBox('Verifique el formulario, aun tiene campos obligatorio completar.');
7300
+ if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
7301
+ top: 0,
7302
+ behavior: 'smooth'
7303
+ });
7328
7304
  }
7329
- me.MsgBox('Verifique el formulario, aun tiene campos obligatorio completar.');
7330
- if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
7331
- top: 0,
7332
- behavior: 'smooth'
7333
- });
7334
7305
  }
7335
- }
7336
- });
7337
- }
7338
- }();
7339
- } else {
7340
- me.MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
7341
- if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
7342
- top: 0,
7343
- behavior: 'smooth'
7344
- });
7345
- }
7346
- }());
7347
- } catch (e) {
7348
- return Promise.reject(e);
7349
- }
7350
- },
7351
- saveAs: function saveAs(url, o, config) {
7352
- if (typeof o == 'string') o = {
7353
- body: o
7354
- };
7355
- var cfg = typeof config == 'string' ? {
7356
- fileName: config
7357
- } : config;
7358
- if (!cfg) cfg = {};
7359
-
7360
- /*
7361
- var requestOptions = {
7362
- method: 'POST',
7363
- body: formdata
7364
- };
7365
-
7366
- fetch("http://{url}", requestOptions)
7367
- .then(response => response.text())
7368
- .then(result => console.log(result))
7369
- .catch(error => console.log('error', error))
7370
- */
7371
- var a = "" + o ? axios__default["default"].post(url, o, {
7372
- responseType: 'blob'
7373
- }) : axios__default["default"]({
7374
- method: "post",
7375
- url: url,
7376
- data: o,
7377
- headers: {
7378
- "Content-Type": "multipart/form-data"
7306
+ });
7307
+ }
7308
+ }();
7309
+ } else {
7310
+ me.MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
7311
+ if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
7312
+ top: 0,
7313
+ behavior: 'smooth'
7314
+ });
7315
+ }
7316
+ }());
7317
+ } catch (e) {
7318
+ return Promise.reject(e);
7379
7319
  }
7380
- });
7381
- a.then(function (response) {
7382
- //console.log(response);
7383
- var url = window.URL.createObjectURL(new Blob([response.data]));
7384
- var link = document.createElement('a');
7385
- link.href = url;
7386
- if (!cfg.fileName) var disposition = response.headers['content-disposition'];
7387
- if (disposition && disposition.indexOf('attachment') !== -1) {
7388
- var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
7389
- var matches = filenameRegex.exec(disposition);
7390
- if (matches != null && matches[1]) {
7391
- cfg.fileName = matches[1].replace(/['"]/g, '').trim();
7320
+ },
7321
+ saveAs: function saveAs(url, o, config) {
7322
+ if (typeof o == 'string') o = {
7323
+ body: o
7324
+ };
7325
+ var cfg = typeof config == 'string' ? {
7326
+ fileName: config
7327
+ } : config;
7328
+ if (!cfg) cfg = {};
7329
+
7330
+ /*
7331
+ var requestOptions = {
7332
+ method: 'POST',
7333
+ body: formdata
7334
+ };
7335
+
7336
+ fetch("http://{url}", requestOptions)
7337
+ .then(response => response.text())
7338
+ .then(result => console.log(result))
7339
+ .catch(error => console.log('error', error))
7340
+ */
7341
+ var a = "" + o ? axios__default["default"].post(url, o, {
7342
+ responseType: 'blob'
7343
+ }) : axios__default["default"]({
7344
+ method: "post",
7345
+ url: url,
7346
+ data: o,
7347
+ headers: {
7348
+ "Content-Type": "multipart/form-data"
7392
7349
  }
7393
- }
7394
- //console.log('cfg.fileName='+cfg.fileName);
7395
- link.setAttribute('download', cfg.fileName);
7396
- document.body.appendChild(link);
7397
- link.click();
7398
- });
7399
- },
7400
- savePost: function savePost() {},
7401
- validate: function validate(e2) {
7402
- var me = this;
7403
- var ok = true;
7404
- e2 = e2 ? e2 : me.$el;
7405
- var input = e2.querySelectorAll("input,select,textarea,div[required=required]");
7406
- var radio = {},
7407
- previousElementSibling;
7408
- for (i = 0; input.length > i; i++) {
7409
- var e = input[i];
7410
- if (e.type === 'radio') {
7411
- var oo = radio[e.name];
7412
- if (!oo) radio[e.name] = oo = [];
7413
- oo.push(e);
7414
- continue;
7415
- }
7416
- previousElementSibling = e.previousElementSibling;
7417
- if (previousElementSibling && previousElementSibling.classList && previousElementSibling.classList.contains('v-error')) {
7418
- previousElementSibling.parentNode.removeChild(previousElementSibling);
7419
- }
7420
- if (!(e.disabled || e.getAttribute('disabled')) && (e.required || e.tagName === 'DIV')) {
7421
- //console.log([e]);
7422
- //console.log(e.value);console.log(e.nodeValue);
7423
-
7424
- if (e.tagName != 'DIV' && !e.value /*||e.value == 0*/ || e.tagName === 'DIV' && !e.attributes.value) {
7425
- previousElementSibling = e.previousElementSibling;
7426
- while (previousElementSibling && previousElementSibling.nodeType != 1) {
7427
- previousElementSibling = previousElementSibling.previousElementSibling;
7428
- }
7429
- if (!previousElementSibling) {
7430
- previousElementSibling = e.parentElement.previousElementSibling;
7431
- while (previousElementSibling && previousElementSibling.nodeType != 1) {
7432
- previousElementSibling = previousElementSibling.previousElementSibling;
7433
- }
7350
+ });
7351
+ a.then(function (response) {
7352
+ //console.log(response);
7353
+ var url = window.URL.createObjectURL(new Blob([response.data]));
7354
+ var link = document.createElement('a');
7355
+ link.href = url;
7356
+ if (!cfg.fileName) var disposition = response.headers['content-disposition'];
7357
+ if (disposition && disposition.indexOf('attachment') !== -1) {
7358
+ var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
7359
+ var matches = filenameRegex.exec(disposition);
7360
+ if (matches != null && matches[1]) {
7361
+ cfg.fileName = matches[1].replace(/['"]/g, '').trim();
7434
7362
  }
7435
- var error = document.createElement("div");
7436
- error.innerHTML = "Este campo es requerido!";
7437
- ok = false;
7438
- error.classList.add("v-error");
7439
- e.parentNode.insertBefore(error, e);
7440
7363
  }
7441
- }
7442
- }
7443
- for (var r in radio) {
7444
- if (Object.prototype.hasOwnProperty.call(radio, r)) {
7445
- var op = radio[r];
7446
- var checked = false;
7447
- var required = false;
7448
- for (var i = 0; i < op.length; i++) {
7449
- if (op[i].required && !op[i].disabled) required = true;
7450
- if (op[i].checked) checked = true;
7364
+ //console.log('cfg.fileName='+cfg.fileName);
7365
+ link.setAttribute('download', cfg.fileName);
7366
+ document.body.appendChild(link);
7367
+ link.click();
7368
+ });
7369
+ },
7370
+ savePost: function savePost() {},
7371
+ validate: function validate(e2) {
7372
+ var me = this;
7373
+ var ok = true;
7374
+ e2 = e2 ? e2 : me.$el;
7375
+ var input = e2.querySelectorAll("input,select,textarea,div[required=required]");
7376
+ var radio = {},
7377
+ previousElementSibling;
7378
+ for (i = 0; input.length > i; i++) {
7379
+ var e = input[i];
7380
+ if (e.type === 'radio') {
7381
+ var oo = radio[e.name];
7382
+ if (!oo) radio[e.name] = oo = [];
7383
+ oo.push(e);
7384
+ continue;
7451
7385
  }
7452
- e = op[0].parentNode.parentNode;
7453
7386
  previousElementSibling = e.previousElementSibling;
7454
7387
  if (previousElementSibling && previousElementSibling.classList && previousElementSibling.classList.contains('v-error')) {
7455
7388
  previousElementSibling.parentNode.removeChild(previousElementSibling);
7456
7389
  }
7457
- if (required && !checked) {
7458
- me.showerror(e);
7459
- /*previousElementSibling = e.previousElementSibling;
7460
- while(previousElementSibling&&previousElementSibling.nodeType != 1) {
7461
- previousElementSibling = previousElementSibling.previousElementSibling;
7462
- }
7463
- if(!previousElementSibling){
7464
- previousElementSibling=e.parentElement.previousElementSibling;
7465
- while(previousElementSibling&&previousElementSibling.nodeType != 1) {
7466
- previousElementSibling = previousElementSibling.previousElementSibling;
7467
- }
7468
- }
7469
- var error = document.createElement("div");
7470
- error.innerHTML = "Este campo es requerido!";*/
7471
- ok = false;
7472
- //error.classList.add("v-error");
7473
- //e.parentNode.insertBefore(error, e);
7390
+ if (!(e.disabled || e.getAttribute('disabled')) && (e.required || e.tagName === 'DIV')) {
7391
+ //console.log([e]);
7392
+ //console.log(e.value);console.log(e.nodeValue);
7393
+
7394
+ if (e.tagName != 'DIV' && !e.value /*||e.value == 0*/ || e.tagName === 'DIV' && !e.attributes.value) {
7395
+ previousElementSibling = e.previousElementSibling;
7396
+ while (previousElementSibling && previousElementSibling.nodeType != 1) {
7397
+ previousElementSibling = previousElementSibling.previousElementSibling;
7398
+ }
7399
+ if (!previousElementSibling) {
7400
+ previousElementSibling = e.parentElement.previousElementSibling;
7401
+ while (previousElementSibling && previousElementSibling.nodeType != 1) {
7402
+ previousElementSibling = previousElementSibling.previousElementSibling;
7403
+ }
7404
+ }
7405
+ var error = document.createElement("div");
7406
+ error.innerHTML = "Este campo es requerido!";
7407
+ ok = false;
7408
+ error.classList.add("v-error");
7409
+ e.parentNode.insertBefore(error, e);
7410
+ }
7411
+ }
7412
+ }
7413
+ for (var r in radio) {
7414
+ if (Object.prototype.hasOwnProperty.call(radio, r)) {
7415
+ var op = radio[r];
7416
+ var checked = false;
7417
+ var required = false;
7418
+ for (var i = 0; i < op.length; i++) {
7419
+ if (op[i].required && !op[i].disabled) required = true;
7420
+ if (op[i].checked) checked = true;
7421
+ }
7422
+ e = op[0].parentNode.parentNode;
7423
+ previousElementSibling = e.previousElementSibling;
7424
+ if (previousElementSibling && previousElementSibling.classList && previousElementSibling.classList.contains('v-error')) {
7425
+ previousElementSibling.parentNode.removeChild(previousElementSibling);
7426
+ }
7427
+ if (required && !checked) {
7428
+ me.showerror(e);
7429
+ /*previousElementSibling = e.previousElementSibling;
7430
+ while(previousElementSibling&&previousElementSibling.nodeType != 1) {
7431
+ previousElementSibling = previousElementSibling.previousElementSibling;
7432
+ }
7433
+ if(!previousElementSibling){
7434
+ previousElementSibling=e.parentElement.previousElementSibling;
7435
+ while(previousElementSibling&&previousElementSibling.nodeType != 1) {
7436
+ previousElementSibling = previousElementSibling.previousElementSibling;
7437
+ }
7438
+ }
7439
+ var error = document.createElement("div");
7440
+ error.innerHTML = "Este campo es requerido!";*/
7441
+ ok = false;
7442
+ //error.classList.add("v-error");
7443
+ //e.parentNode.insertBefore(error, e);
7444
+ }
7474
7445
  }
7475
7446
  }
7476
- }
7477
7447
 
7478
- return ok;
7479
- },
7480
- showerror: _$1.showerror
7481
- }), _defs);
7448
+ return ok;
7449
+ },
7450
+ showerror: _$1.showerror
7451
+ }
7452
+ };
7482
7453
  if (!cfg) cfg = {
7483
7454
  data: {
7484
7455
  o: {}