isobit-ui 0.2.130 → 0.2.132

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