isobit-ui 0.0.336 → 0.0.339
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.
- package/dist/index.js +53 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* isobit-ui v0.0.
|
|
2
|
+
* isobit-ui v0.0.339
|
|
3
3
|
* (c) Erik Alarcon Pinedo
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -6382,6 +6382,7 @@ window.ui = _$1.ui = function (cfg) {
|
|
|
6382
6382
|
save: function save() {
|
|
6383
6383
|
try {
|
|
6384
6384
|
var _exit2 = false;
|
|
6385
|
+
var objectStore;
|
|
6385
6386
|
|
|
6386
6387
|
var _this4 = this;
|
|
6387
6388
|
|
|
@@ -6414,63 +6415,58 @@ window.ui = _$1.ui = function (cfg) {
|
|
|
6414
6415
|
|
|
6415
6416
|
if (!(_typeof(o) === 'object' && !Array.isArray(o) && o !== null)) return;
|
|
6416
6417
|
return _invoke(function () {
|
|
6417
|
-
if (!action || !_this4.app.networkStatus.connected
|
|
6418
|
+
if (!action || !_this4.app.networkStatus.connected) {
|
|
6418
6419
|
var storage = me.$children[0].storage;
|
|
6419
|
-
return _await(me.getStoredList(storage), function (
|
|
6420
|
-
|
|
6421
|
-
if (!datj) datj = [];
|
|
6420
|
+
return _await(me.getStoredList(storage), function (storedList) {
|
|
6421
|
+
if (!storedList) storedList = [];
|
|
6422
6422
|
|
|
6423
6423
|
if (o.id) {
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
for (var k = 0; k < datj.length; k++) {
|
|
6427
|
-
if (datj[k].tmpId == o.tmpId) {
|
|
6424
|
+
for (var k = 0; k < storedList.length; k++) {
|
|
6425
|
+
if (storedList[k].tmpId == o.tmpId) {
|
|
6428
6426
|
delete o.tmpSynchronized;
|
|
6429
|
-
|
|
6427
|
+
storedList[k] = o;
|
|
6430
6428
|
return;
|
|
6431
6429
|
}
|
|
6432
6430
|
}
|
|
6433
6431
|
}
|
|
6434
6432
|
|
|
6435
6433
|
var db = window._.db;
|
|
6436
|
-
|
|
6434
|
+
objectStore = db.transaction([storage], "readwrite").objectStore(storage);
|
|
6437
6435
|
|
|
6438
6436
|
if (!o.id) {
|
|
6439
6437
|
o.id = -new Date();
|
|
6440
|
-
o.tmpId = +new Date();
|
|
6441
|
-
|
|
6438
|
+
o.tmpId = +new Date(); //add new item to start to array
|
|
6439
|
+
|
|
6440
|
+
storedList.unshift(o);
|
|
6442
6441
|
objectStore.add(o);
|
|
6443
|
-
me.$emit('storage',
|
|
6444
|
-
|
|
6442
|
+
me.$emit('storage', o, storedList);
|
|
6443
|
+
me.close({
|
|
6444
|
+
success: true,
|
|
6445
6445
|
data: o
|
|
6446
|
-
});
|
|
6447
|
-
me.close(true);
|
|
6448
|
-
}
|
|
6446
|
+
});
|
|
6449
6447
|
} else {
|
|
6450
6448
|
var item = objectStore.get(o.tmpId);
|
|
6451
6449
|
|
|
6452
6450
|
item.onsuccess = function () {
|
|
6453
6451
|
if (item.result) {
|
|
6454
|
-
|
|
6455
|
-
objectStore.put(o); //window._.MsgBox('Modificado');
|
|
6452
|
+
objectStore.put(o);
|
|
6456
6453
|
} else {
|
|
6457
|
-
|
|
6454
|
+
storedList.forEach(function (ee) {
|
|
6458
6455
|
if (ee.tmpId == o.tmpId) {
|
|
6459
6456
|
objectStore.put(o);
|
|
6460
6457
|
}
|
|
6461
|
-
});
|
|
6458
|
+
});
|
|
6462
6459
|
}
|
|
6463
6460
|
|
|
6464
|
-
me.$emit('storage',
|
|
6465
|
-
|
|
6461
|
+
me.$emit('storage', o, storedList);
|
|
6462
|
+
me.close({
|
|
6463
|
+
success: true,
|
|
6466
6464
|
data: o
|
|
6467
|
-
});
|
|
6468
|
-
me.close(true);
|
|
6469
|
-
}
|
|
6465
|
+
});
|
|
6470
6466
|
};
|
|
6471
6467
|
|
|
6472
6468
|
item.onerror = function () {
|
|
6473
|
-
me.MsgBox('
|
|
6469
|
+
me.MsgBox('Error getting temporal record ' + o.tmpId);
|
|
6474
6470
|
};
|
|
6475
6471
|
}
|
|
6476
6472
|
|
|
@@ -6479,11 +6475,36 @@ window.ui = _$1.ui = function (cfg) {
|
|
|
6479
6475
|
}
|
|
6480
6476
|
}, function (_result) {
|
|
6481
6477
|
if (_exit2) return _result;
|
|
6482
|
-
axios__default['default'].post(action, o).then(function (
|
|
6478
|
+
axios__default['default'].post(action, o).then(function (result) {
|
|
6479
|
+
var data = result.data;
|
|
6480
|
+
console.log(11);
|
|
6481
|
+
|
|
6482
|
+
if (o.tmpId) {
|
|
6483
|
+
var item = objectStore.get(o.tmpId);
|
|
6484
|
+
o.tmpSynchronized = 1;
|
|
6485
|
+
if (data.id) o.id = data.id;
|
|
6486
|
+
|
|
6487
|
+
item.onsuccess = function () {
|
|
6488
|
+
if (item.result) {
|
|
6489
|
+
objectStore.put(o);
|
|
6490
|
+
} else {
|
|
6491
|
+
objectStore.add(o);
|
|
6492
|
+
}
|
|
6493
|
+
|
|
6494
|
+
me.$emit('sync', data, o);
|
|
6495
|
+
};
|
|
6496
|
+
|
|
6497
|
+
item.onerror = function () {
|
|
6498
|
+
me.MsgBox('Error getting temporal record ' + o.tmpId);
|
|
6499
|
+
};
|
|
6500
|
+
}
|
|
6501
|
+
|
|
6502
|
+
console.log(22);
|
|
6483
6503
|
me.MsgBox('El registro fue grabado exitosamente!', function () {
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6504
|
+
me.close({
|
|
6505
|
+
success: true,
|
|
6506
|
+
data: data
|
|
6507
|
+
});
|
|
6487
6508
|
});
|
|
6488
6509
|
})["catch"](function (r) {
|
|
6489
6510
|
if (r.response) {
|