vue-laravel-crud 1.7.3 → 1.7.5
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/vue-laravel-crud.esm.js +57 -38
- package/dist/vue-laravel-crud.min.js +1 -1
- package/dist/vue-laravel-crud.ssr.js +286 -245
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +69 -40
|
@@ -12532,7 +12532,7 @@ Plugin.install = function (Vue, options) {
|
|
|
12532
12532
|
|
|
12533
12533
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
12534
12534
|
window.Vue.use(Plugin);
|
|
12535
|
-
}var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}var css = "tr td[data-v-
|
|
12535
|
+
}var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}var css = "tr td[data-v-e8340149]:last-child,\ntr td[data-v-e8340149]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-e8340149] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-e8340149] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-e8340149] .crud-title[data-v-e8340149] {\n margin: 0; }\n .crud-header[data-v-e8340149] .crud-search[data-v-e8340149] {\n max-width: 15rem; }\n .crud-header[data-v-e8340149] .crud-search[data-v-e8340149] .btn[data-v-e8340149] {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 0.375rem;\n border-bottom-right-radius: 0.375rem; }\n .crud-header[data-v-e8340149] .crud-search[data-v-e8340149] .btn[data-v-e8340149].open[data-v-e8340149] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-e8340149] .table-options[data-v-e8340149] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-e8340149] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-e8340149] {\n table-layout: auto; }\n .table[data-v-e8340149] tbody[data-v-e8340149] td[data-v-e8340149] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-e8340149] tbody[data-v-e8340149] td[data-v-e8340149]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12536
12536
|
n(css, {});function normalizeComponent (
|
|
12537
12537
|
scriptExports,
|
|
12538
12538
|
render,
|
|
@@ -13032,17 +13032,7 @@ n(css, {});function normalizeComponent (
|
|
|
13032
13032
|
console.debug("crud mounted columns", this.columns);
|
|
13033
13033
|
this.internalFilters = [];
|
|
13034
13034
|
this.setupFilters();
|
|
13035
|
-
|
|
13036
|
-
this.fetchItems();
|
|
13037
|
-
} else {
|
|
13038
|
-
if (this.grouped) {
|
|
13039
|
-
this.groupItems(this.models);
|
|
13040
|
-
} else {
|
|
13041
|
-
this.items = this.models;
|
|
13042
|
-
}
|
|
13043
|
-
this.pagination.total = this.items.length;
|
|
13044
|
-
this.firstLoad = true;
|
|
13045
|
-
}
|
|
13035
|
+
this.fetchItems();
|
|
13046
13036
|
this.loadOptions();
|
|
13047
13037
|
},
|
|
13048
13038
|
computed: {
|
|
@@ -13312,6 +13302,29 @@ n(css, {});function normalizeComponent (
|
|
|
13312
13302
|
this.$emit("select", this.item);
|
|
13313
13303
|
this.$emit("selectItems", this.selectedItems);
|
|
13314
13304
|
},
|
|
13305
|
+
updateData: function updateData(data) {
|
|
13306
|
+
var _this8 = this;
|
|
13307
|
+
var allowCreate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
13308
|
+
// Convertir this.items a un mapa para acceso rápido por id
|
|
13309
|
+
var itemsMap = new Map(this.items.map(function (item) {
|
|
13310
|
+
return [item.id, item];
|
|
13311
|
+
}));
|
|
13312
|
+
|
|
13313
|
+
// Recorrer cada elemento de data
|
|
13314
|
+
data.forEach(function (newItem) {
|
|
13315
|
+
if (itemsMap.has(newItem.id)) {
|
|
13316
|
+
// Actualizar el item existente
|
|
13317
|
+
var existingItem = itemsMap.get(newItem.id);
|
|
13318
|
+
Object.assign(existingItem, newItem);
|
|
13319
|
+
} else if (allowCreate) {
|
|
13320
|
+
// Agregar el nuevo item si allowCreate es true
|
|
13321
|
+
_this8.items.push(newItem);
|
|
13322
|
+
}
|
|
13323
|
+
});
|
|
13324
|
+
|
|
13325
|
+
// Convertir el mapa de vuelta a un array, si es necesario
|
|
13326
|
+
this.items = Array.from(itemsMap.values());
|
|
13327
|
+
},
|
|
13315
13328
|
showItem: function showItem(id) {
|
|
13316
13329
|
var itemIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
13317
13330
|
if (itemIndex == null) {
|
|
@@ -13353,11 +13366,8 @@ n(css, {});function normalizeComponent (
|
|
|
13353
13366
|
this.$bvModal.show("modal-form-item-" + this.modelName);
|
|
13354
13367
|
},
|
|
13355
13368
|
refresh: function refresh() {
|
|
13356
|
-
var
|
|
13369
|
+
var _this9 = this;
|
|
13357
13370
|
this.$emit("refresh", {});
|
|
13358
|
-
if (!this.ajax) {
|
|
13359
|
-
return;
|
|
13360
|
-
}
|
|
13361
13371
|
if (this.infiniteScroll) {
|
|
13362
13372
|
this.pagination.current_page = 1;
|
|
13363
13373
|
this.infiniteScrollKey++;
|
|
@@ -13366,13 +13376,13 @@ n(css, {});function normalizeComponent (
|
|
|
13366
13376
|
if (this.infiniteScroll && fetchPromise) {
|
|
13367
13377
|
this.refreshing = true;
|
|
13368
13378
|
fetchPromise.then(function () {
|
|
13369
|
-
var infiniteLoadingRef =
|
|
13379
|
+
var infiniteLoadingRef = _this9.$refs.infiniteLoading;
|
|
13370
13380
|
if (infiniteLoadingRef) {
|
|
13371
13381
|
infiniteLoadingRef.stateChanger.reset();
|
|
13372
13382
|
} else {
|
|
13373
13383
|
console.debug("infiniteLoadingRef not set");
|
|
13374
13384
|
}
|
|
13375
|
-
|
|
13385
|
+
_this9.refreshing = false;
|
|
13376
13386
|
});
|
|
13377
13387
|
}
|
|
13378
13388
|
},
|
|
@@ -13380,56 +13390,56 @@ n(css, {});function normalizeComponent (
|
|
|
13380
13390
|
return column && !column.hideFilter && column.type != "actions";
|
|
13381
13391
|
},
|
|
13382
13392
|
setFilter: function setFilter(column, value) {
|
|
13383
|
-
var
|
|
13393
|
+
var _this10 = this;
|
|
13384
13394
|
var filter = this.filter.find(function (f) {
|
|
13385
13395
|
return f.column == column;
|
|
13386
13396
|
});
|
|
13387
13397
|
filter.value = value;
|
|
13388
13398
|
this.forceRecomputeCounter++;
|
|
13389
13399
|
setTimeout(function () {
|
|
13390
|
-
|
|
13400
|
+
_this10.refresh();
|
|
13391
13401
|
}, 1);
|
|
13392
13402
|
},
|
|
13393
13403
|
fetchItemsVuex: function fetchItemsVuex() {
|
|
13394
13404
|
var _arguments = arguments,
|
|
13395
|
-
|
|
13405
|
+
_this11 = this;
|
|
13396
13406
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13397
13407
|
var page, result, itemsResult;
|
|
13398
13408
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13399
13409
|
while (1) switch (_context.prev = _context.next) {
|
|
13400
13410
|
case 0:
|
|
13401
13411
|
page = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : 1;
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
if (!
|
|
13412
|
+
_this11.loading = true;
|
|
13413
|
+
_this11.$emit("beforeFetch", {});
|
|
13414
|
+
if (!_this11.vuexLocalforage) {
|
|
13405
13415
|
_context.next = 9;
|
|
13406
13416
|
break;
|
|
13407
13417
|
}
|
|
13408
13418
|
_context.next = 7;
|
|
13409
|
-
return
|
|
13419
|
+
return _this11.model.$fetch();
|
|
13410
13420
|
case 7:
|
|
13411
13421
|
_context.next = 13;
|
|
13412
13422
|
break;
|
|
13413
13423
|
case 9:
|
|
13414
|
-
|
|
13424
|
+
_this11.model.deleteAll();
|
|
13415
13425
|
_context.next = 12;
|
|
13416
|
-
return
|
|
13426
|
+
return _this11.model.api().get('', {
|
|
13417
13427
|
params: {
|
|
13418
13428
|
page: page,
|
|
13419
|
-
limit:
|
|
13420
|
-
filters: JSON.stringify(
|
|
13429
|
+
limit: _this11.pagination.perPage,
|
|
13430
|
+
filters: JSON.stringify(_this11.finalFilters)
|
|
13421
13431
|
}
|
|
13422
13432
|
});
|
|
13423
13433
|
case 12:
|
|
13424
13434
|
result = _context.sent;
|
|
13425
13435
|
case 13:
|
|
13426
|
-
itemsResult =
|
|
13436
|
+
itemsResult = _this11.model.query().withAll().get(); //let itemsResult = result.entities[this.model.entity];
|
|
13427
13437
|
if (itemsResult) {
|
|
13428
|
-
|
|
13438
|
+
_this11.items = itemsResult;
|
|
13429
13439
|
}
|
|
13430
|
-
console.debug("fetch page vuex ", itemsResult, page,
|
|
13431
|
-
|
|
13432
|
-
|
|
13440
|
+
console.debug("fetch page vuex ", itemsResult, page, _this11.items, result);
|
|
13441
|
+
_this11.loading = false;
|
|
13442
|
+
_this11.firstLoad = true;
|
|
13433
13443
|
case 18:
|
|
13434
13444
|
case "end":
|
|
13435
13445
|
return _context.stop();
|
|
@@ -13437,17 +13447,26 @@ n(css, {});function normalizeComponent (
|
|
|
13437
13447
|
}, _callee);
|
|
13438
13448
|
}))();
|
|
13439
13449
|
},
|
|
13450
|
+
fetchItemsLocal: function fetchItemsLocal() {
|
|
13451
|
+
if (this.grouped) {
|
|
13452
|
+
this.groupItems(this.models);
|
|
13453
|
+
} else {
|
|
13454
|
+
this.items = this.models;
|
|
13455
|
+
}
|
|
13456
|
+
this.pagination.total = this.items.length;
|
|
13457
|
+
this.firstLoad = true;
|
|
13458
|
+
},
|
|
13440
13459
|
fetchItems: function fetchItems() {
|
|
13441
|
-
var
|
|
13460
|
+
var _this12 = this;
|
|
13442
13461
|
var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
13443
13462
|
var concat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
13444
|
-
if (!this.ajax) {
|
|
13445
|
-
return;
|
|
13446
|
-
}
|
|
13447
13463
|
this.$emit("beforeFetch", {});
|
|
13448
13464
|
if (this.useVuexORM) {
|
|
13449
13465
|
return this.fetchItemsVuex(page, concat);
|
|
13450
13466
|
}
|
|
13467
|
+
if (!this.ajax) {
|
|
13468
|
+
return this.fetchItemsLocal(page, concat);
|
|
13469
|
+
}
|
|
13451
13470
|
this.loading = true;
|
|
13452
13471
|
return axios.get(this.apiUrl + "/" + this.modelName, {
|
|
13453
13472
|
params: {
|
|
@@ -13456,26 +13475,26 @@ n(css, {});function normalizeComponent (
|
|
|
13456
13475
|
filters: JSON.stringify(this.finalFilters)
|
|
13457
13476
|
}
|
|
13458
13477
|
}).then(function (response) {
|
|
13459
|
-
|
|
13478
|
+
_this12.makePagination(response.data);
|
|
13460
13479
|
var items = response.data.data;
|
|
13461
|
-
if (
|
|
13462
|
-
|
|
13480
|
+
if (_this12.grouped) {
|
|
13481
|
+
_this12.groupItems(items, concat);
|
|
13463
13482
|
} else {
|
|
13464
13483
|
if (concat) {
|
|
13465
|
-
|
|
13484
|
+
_this12.items = _this12.items.concat(items);
|
|
13466
13485
|
} else {
|
|
13467
|
-
|
|
13486
|
+
_this12.items = items;
|
|
13468
13487
|
}
|
|
13469
13488
|
}
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13489
|
+
_this12.loading = false;
|
|
13490
|
+
_this12.firstLoad = true;
|
|
13491
|
+
_this12.$emit("afterFetch", {});
|
|
13473
13492
|
}).catch(function (error) {
|
|
13474
13493
|
//console.debug(error);
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13494
|
+
_this12.toastError(error);
|
|
13495
|
+
_this12.loading = false;
|
|
13496
|
+
_this12.firstLoad = true;
|
|
13497
|
+
_this12.fetchError = true;
|
|
13479
13498
|
});
|
|
13480
13499
|
},
|
|
13481
13500
|
groupItems: function groupItems(items) {
|
|
@@ -13512,7 +13531,7 @@ n(css, {});function normalizeComponent (
|
|
|
13512
13531
|
}
|
|
13513
13532
|
},
|
|
13514
13533
|
removeItem: function removeItem(id, index) {
|
|
13515
|
-
var
|
|
13534
|
+
var _this13 = this;
|
|
13516
13535
|
this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
|
|
13517
13536
|
size: "sm",
|
|
13518
13537
|
buttonSize: "sm",
|
|
@@ -13522,15 +13541,15 @@ n(css, {});function normalizeComponent (
|
|
|
13522
13541
|
centered: true
|
|
13523
13542
|
}).then(function (value) {
|
|
13524
13543
|
if (value) {
|
|
13525
|
-
|
|
13544
|
+
_this13.deleteItem(id, index);
|
|
13526
13545
|
}
|
|
13527
13546
|
}).catch(function (error) {
|
|
13528
|
-
|
|
13529
|
-
|
|
13547
|
+
_this13.toastError(error);
|
|
13548
|
+
_this13.loading = false;
|
|
13530
13549
|
});
|
|
13531
13550
|
},
|
|
13532
13551
|
confirmBulkDelete: function confirmBulkDelete() {
|
|
13533
|
-
var
|
|
13552
|
+
var _this14 = this;
|
|
13534
13553
|
this.$bvModal.msgBoxConfirm(this.messageRemoveBulkConfirm, {
|
|
13535
13554
|
size: "sm",
|
|
13536
13555
|
buttonSize: "sm",
|
|
@@ -13540,15 +13559,15 @@ n(css, {});function normalizeComponent (
|
|
|
13540
13559
|
centered: true
|
|
13541
13560
|
}).then(function (value) {
|
|
13542
13561
|
if (value) {
|
|
13543
|
-
|
|
13562
|
+
_this14.deleteItemBulk();
|
|
13544
13563
|
}
|
|
13545
13564
|
}).catch(function (error) {
|
|
13546
|
-
|
|
13547
|
-
|
|
13565
|
+
_this14.toastError(error);
|
|
13566
|
+
_this14.loading = false;
|
|
13548
13567
|
});
|
|
13549
13568
|
},
|
|
13550
13569
|
deleteItemBulk: function deleteItemBulk() {
|
|
13551
|
-
var
|
|
13570
|
+
var _this15 = this;
|
|
13552
13571
|
if (this.useVuexORM) {
|
|
13553
13572
|
return this.deleteItemBulkVuex();
|
|
13554
13573
|
}
|
|
@@ -13564,34 +13583,34 @@ n(css, {});function normalizeComponent (
|
|
|
13564
13583
|
ids: ids
|
|
13565
13584
|
}
|
|
13566
13585
|
}).then(function (response) {
|
|
13567
|
-
|
|
13586
|
+
_this15.items = _this15.items.filter(function (it) {
|
|
13568
13587
|
return !ids.includes(it.id);
|
|
13569
13588
|
});
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13589
|
+
_this15.toastSuccess("Elemento/s eliminado.");
|
|
13590
|
+
_this15.$emit("itemDeleted", {});
|
|
13591
|
+
_this15.loading = false;
|
|
13573
13592
|
}).catch(function (error) {
|
|
13574
|
-
|
|
13575
|
-
|
|
13593
|
+
_this15.toastError(error);
|
|
13594
|
+
_this15.loading = false;
|
|
13576
13595
|
});
|
|
13577
13596
|
},
|
|
13578
13597
|
deleteItemBulkLocal: function deleteItemBulkLocal() {
|
|
13579
|
-
var
|
|
13598
|
+
var _this16 = this;
|
|
13580
13599
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
13581
13600
|
var ids;
|
|
13582
13601
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
13583
13602
|
while (1) switch (_context2.prev = _context2.next) {
|
|
13584
13603
|
case 0:
|
|
13585
|
-
ids =
|
|
13604
|
+
ids = _this16.selectedItems.map(function (it) {
|
|
13586
13605
|
return it.id;
|
|
13587
13606
|
});
|
|
13588
|
-
|
|
13607
|
+
_this16.items = _this16.items.filter(function (it) {
|
|
13589
13608
|
return !ids.includes(it.id);
|
|
13590
13609
|
});
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13610
|
+
_this16.item = null;
|
|
13611
|
+
_this16.toastSuccess("Elemento Eliminado");
|
|
13612
|
+
_this16.$emit("itemDeleted", {});
|
|
13613
|
+
_this16.loading = false;
|
|
13595
13614
|
case 6:
|
|
13596
13615
|
case "end":
|
|
13597
13616
|
return _context2.stop();
|
|
@@ -13600,32 +13619,54 @@ n(css, {});function normalizeComponent (
|
|
|
13600
13619
|
}))();
|
|
13601
13620
|
},
|
|
13602
13621
|
deleteItemBulkVuex: function deleteItemBulkVuex() {
|
|
13622
|
+
var _this17 = this;
|
|
13603
13623
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
13624
|
+
var ids, result;
|
|
13604
13625
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
13605
13626
|
while (1) switch (_context3.prev = _context3.next) {
|
|
13606
13627
|
case 0:
|
|
13628
|
+
ids = _this17.selectedItems.map(function (it) {
|
|
13629
|
+
return it.id;
|
|
13630
|
+
});
|
|
13631
|
+
if (!_this17.vuexLocalforage) {
|
|
13632
|
+
_context3.next = 6;
|
|
13633
|
+
break;
|
|
13634
|
+
}
|
|
13635
|
+
_context3.next = 4;
|
|
13636
|
+
return _this17.model.$delete(ids);
|
|
13637
|
+
case 4:
|
|
13638
|
+
_context3.next = 15;
|
|
13639
|
+
break;
|
|
13640
|
+
case 6:
|
|
13641
|
+
_context3.next = 8;
|
|
13642
|
+
return _this17.model.api().delete('/bulk-destroy', {
|
|
13643
|
+
params: {
|
|
13644
|
+
ids: ids
|
|
13645
|
+
},
|
|
13646
|
+
delete: ids
|
|
13647
|
+
});
|
|
13648
|
+
case 8:
|
|
13649
|
+
result = _context3.sent;
|
|
13650
|
+
console.debug("delete item vuex", result);
|
|
13651
|
+
result.response.status;
|
|
13652
|
+
if (!result.response.data.error) {
|
|
13653
|
+
_context3.next = 15;
|
|
13654
|
+
break;
|
|
13655
|
+
}
|
|
13656
|
+
_this17.toastError(result.response.data.error);
|
|
13657
|
+
_this17.loading = false;
|
|
13658
|
+
return _context3.abrupt("return");
|
|
13659
|
+
case 15:
|
|
13660
|
+
_this17.toastSuccess("Elemento eliminados.");
|
|
13661
|
+
case 16:
|
|
13607
13662
|
case "end":
|
|
13608
13663
|
return _context3.stop();
|
|
13609
13664
|
}
|
|
13610
13665
|
}, _callee3);
|
|
13611
13666
|
}))();
|
|
13612
|
-
}
|
|
13613
|
-
let result = await this.model.api().delete('/' + id, {
|
|
13614
|
-
delete: 1
|
|
13615
|
-
});
|
|
13616
|
-
|
|
13617
|
-
console.debug("delete item vuex", result);
|
|
13618
|
-
let responseStatus = result.response.status;
|
|
13619
|
-
|
|
13620
|
-
if (result.response.data.error) {
|
|
13621
|
-
this.toastError(result.response.data.error);
|
|
13622
|
-
this.loading = false;
|
|
13623
|
-
return;
|
|
13624
|
-
}
|
|
13625
|
-
|
|
13626
|
-
this.toastSuccess("Elemento eliminado.");*/,
|
|
13667
|
+
},
|
|
13627
13668
|
deleteItem: function deleteItem(id, index) {
|
|
13628
|
-
var
|
|
13669
|
+
var _this18 = this;
|
|
13629
13670
|
if (this.useVuexORM) {
|
|
13630
13671
|
return this.deleteItemVuex(id, index);
|
|
13631
13672
|
}
|
|
@@ -13634,17 +13675,17 @@ n(css, {});function normalizeComponent (
|
|
|
13634
13675
|
}
|
|
13635
13676
|
this.loading = true;
|
|
13636
13677
|
axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(function (response) {
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13678
|
+
_this18.items.splice(index, 1);
|
|
13679
|
+
_this18.toastSuccess("Elemento eliminado.");
|
|
13680
|
+
_this18.$emit("itemDeleted", {});
|
|
13681
|
+
_this18.loading = false;
|
|
13641
13682
|
}).catch(function (error) {
|
|
13642
|
-
|
|
13643
|
-
|
|
13683
|
+
_this18.toastError(error);
|
|
13684
|
+
_this18.loading = false;
|
|
13644
13685
|
});
|
|
13645
13686
|
},
|
|
13646
13687
|
deleteItemLocal: function deleteItemLocal(id, index) {
|
|
13647
|
-
var
|
|
13688
|
+
var _this19 = this;
|
|
13648
13689
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
13649
13690
|
var itemIndex;
|
|
13650
13691
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
@@ -13652,24 +13693,24 @@ n(css, {});function normalizeComponent (
|
|
|
13652
13693
|
case 0:
|
|
13653
13694
|
if (id || index) {
|
|
13654
13695
|
if (id) {
|
|
13655
|
-
itemIndex =
|
|
13656
|
-
return item.id ==
|
|
13696
|
+
itemIndex = _this19.items.findIndex(function (item) {
|
|
13697
|
+
return item.id == _this19.item.id;
|
|
13657
13698
|
});
|
|
13658
13699
|
} else {
|
|
13659
13700
|
itemIndex = index;
|
|
13660
13701
|
}
|
|
13661
13702
|
|
|
13662
13703
|
// Assuming this.items is an array
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13704
|
+
_this19.items.splice(itemIndex, 1);
|
|
13705
|
+
_this19.item = null;
|
|
13706
|
+
_this19.toastSuccess("Elemento Eliminado");
|
|
13707
|
+
_this19.$emit("itemDeleted", {});
|
|
13667
13708
|
} else {
|
|
13668
13709
|
// Handle the case where there's no item.id or item.index
|
|
13669
13710
|
console.error("Cannot delete item without ID or index");
|
|
13670
13711
|
// You might want to show an error message or handle it in a way that fits your application.
|
|
13671
13712
|
}
|
|
13672
|
-
|
|
13713
|
+
_this19.loading = false;
|
|
13673
13714
|
case 2:
|
|
13674
13715
|
case "end":
|
|
13675
13716
|
return _context4.stop();
|
|
@@ -13678,24 +13719,24 @@ n(css, {});function normalizeComponent (
|
|
|
13678
13719
|
}))();
|
|
13679
13720
|
},
|
|
13680
13721
|
deleteItemVuex: function deleteItemVuex(id, index) {
|
|
13681
|
-
var
|
|
13722
|
+
var _this20 = this;
|
|
13682
13723
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
13683
13724
|
var result;
|
|
13684
13725
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
13685
13726
|
while (1) switch (_context5.prev = _context5.next) {
|
|
13686
13727
|
case 0:
|
|
13687
|
-
if (!
|
|
13728
|
+
if (!_this20.vuexLocalforage) {
|
|
13688
13729
|
_context5.next = 5;
|
|
13689
13730
|
break;
|
|
13690
13731
|
}
|
|
13691
13732
|
_context5.next = 3;
|
|
13692
|
-
return
|
|
13733
|
+
return _this20.model.$delete(id);
|
|
13693
13734
|
case 3:
|
|
13694
13735
|
_context5.next = 14;
|
|
13695
13736
|
break;
|
|
13696
13737
|
case 5:
|
|
13697
13738
|
_context5.next = 7;
|
|
13698
|
-
return
|
|
13739
|
+
return _this20.model.api().delete('/' + id, {
|
|
13699
13740
|
delete: 1
|
|
13700
13741
|
});
|
|
13701
13742
|
case 7:
|
|
@@ -13706,11 +13747,11 @@ n(css, {});function normalizeComponent (
|
|
|
13706
13747
|
_context5.next = 14;
|
|
13707
13748
|
break;
|
|
13708
13749
|
}
|
|
13709
|
-
|
|
13710
|
-
|
|
13750
|
+
_this20.toastError(result.response.data.error);
|
|
13751
|
+
_this20.loading = false;
|
|
13711
13752
|
return _context5.abrupt("return");
|
|
13712
13753
|
case 14:
|
|
13713
|
-
|
|
13754
|
+
_this20.toastSuccess("Elemento eliminado.");
|
|
13714
13755
|
case 15:
|
|
13715
13756
|
case "end":
|
|
13716
13757
|
return _context5.stop();
|
|
@@ -13719,14 +13760,14 @@ n(css, {});function normalizeComponent (
|
|
|
13719
13760
|
}))();
|
|
13720
13761
|
},
|
|
13721
13762
|
saveSort: function saveSort() {
|
|
13722
|
-
var
|
|
13763
|
+
var _this21 = this;
|
|
13723
13764
|
if (this.orderable) {
|
|
13724
13765
|
this.loading = true;
|
|
13725
13766
|
var order = [];
|
|
13726
13767
|
this.items.forEach(function (v, k) {
|
|
13727
13768
|
order.push({
|
|
13728
13769
|
id: v.id,
|
|
13729
|
-
order: v[
|
|
13770
|
+
order: v[_this21.orderProp]
|
|
13730
13771
|
});
|
|
13731
13772
|
});
|
|
13732
13773
|
if (!this.ajax) {
|
|
@@ -13736,18 +13777,18 @@ n(css, {});function normalizeComponent (
|
|
|
13736
13777
|
order: order
|
|
13737
13778
|
}).then(function (response) {
|
|
13738
13779
|
response.data;
|
|
13739
|
-
|
|
13740
|
-
if (
|
|
13741
|
-
|
|
13780
|
+
_this21.toastSuccess("Orden Actualizado");
|
|
13781
|
+
if (_this21.refreshAfterSave) _this21.refresh();
|
|
13782
|
+
_this21.loading = false;
|
|
13742
13783
|
}).catch(function (error) {
|
|
13743
13784
|
//console.debug(error);
|
|
13744
|
-
|
|
13745
|
-
|
|
13785
|
+
_this21.toastError(error);
|
|
13786
|
+
_this21.loading = false;
|
|
13746
13787
|
});
|
|
13747
13788
|
}
|
|
13748
13789
|
},
|
|
13749
13790
|
exportItems: function exportItems() {
|
|
13750
|
-
var
|
|
13791
|
+
var _this22 = this;
|
|
13751
13792
|
if (this.useVuexORM) {
|
|
13752
13793
|
return;
|
|
13753
13794
|
}
|
|
@@ -13776,15 +13817,15 @@ n(css, {});function normalizeComponent (
|
|
|
13776
13817
|
params: params,
|
|
13777
13818
|
responseType: "blob"
|
|
13778
13819
|
}).then(function (response) {
|
|
13779
|
-
|
|
13780
|
-
|
|
13820
|
+
_this22.downloadBlobResponse(response);
|
|
13821
|
+
_this22.loading = false;
|
|
13781
13822
|
}).catch(function (error) {
|
|
13782
|
-
|
|
13783
|
-
|
|
13823
|
+
_this22.toastError(error);
|
|
13824
|
+
_this22.loading = false;
|
|
13784
13825
|
});
|
|
13785
13826
|
},
|
|
13786
13827
|
importItems: function importItems() {
|
|
13787
|
-
var
|
|
13828
|
+
var _this23 = this;
|
|
13788
13829
|
var formData = new FormData();
|
|
13789
13830
|
formData.append("file", this.fileImport);
|
|
13790
13831
|
axios.post(this.apiUrl + "/" + this.modelName + "/import", formData, {
|
|
@@ -13793,19 +13834,19 @@ n(css, {});function normalizeComponent (
|
|
|
13793
13834
|
}
|
|
13794
13835
|
}).then(function (response) {
|
|
13795
13836
|
if (response && response.data && response.data.success == true) {
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13837
|
+
_this23.$refs["modal-import"].hide();
|
|
13838
|
+
_this23.toastSuccess("Datos Importados con Éxito");
|
|
13839
|
+
_this23.$refs["crud"].refresh();
|
|
13799
13840
|
} else {
|
|
13800
|
-
|
|
13841
|
+
_this23.toastError("No se pudo importar los datos.");
|
|
13801
13842
|
}
|
|
13802
13843
|
}).catch(function (error) {
|
|
13803
13844
|
console.error(error);
|
|
13804
|
-
|
|
13845
|
+
_this23.toastError(error);
|
|
13805
13846
|
});
|
|
13806
13847
|
},
|
|
13807
13848
|
getArrayValue: function getArrayValue(value, displayProp) {
|
|
13808
|
-
var
|
|
13849
|
+
var _this24 = this;
|
|
13809
13850
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
13810
13851
|
if (!Array.isArray(value)) return "N/A";
|
|
13811
13852
|
var values = [];
|
|
@@ -13822,7 +13863,7 @@ n(css, {});function normalizeComponent (
|
|
|
13822
13863
|
return "";
|
|
13823
13864
|
}
|
|
13824
13865
|
values.forEach(function (val) {
|
|
13825
|
-
valuesFinal.push(
|
|
13866
|
+
valuesFinal.push(_this24.getStateValue(val, options));
|
|
13826
13867
|
});
|
|
13827
13868
|
return values.join(",");
|
|
13828
13869
|
},
|
|
@@ -13844,47 +13885,47 @@ n(css, {});function normalizeComponent (
|
|
|
13844
13885
|
return ops.join(", ");
|
|
13845
13886
|
},
|
|
13846
13887
|
saveItemVuex: function saveItemVuex() {
|
|
13847
|
-
var
|
|
13888
|
+
var _this25 = this;
|
|
13848
13889
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
13849
|
-
var
|
|
13890
|
+
var result, create, jsondata;
|
|
13850
13891
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
13851
13892
|
while (1) switch (_context6.prev = _context6.next) {
|
|
13852
13893
|
case 0:
|
|
13853
|
-
console.debug("save item 1",
|
|
13854
|
-
jsondata = _this23.item.$toJson();
|
|
13855
|
-
console.debug("save item 2", _this23.item, jsondata);
|
|
13894
|
+
console.debug("save item 1", _this25.item);
|
|
13856
13895
|
create = false;
|
|
13857
|
-
if (!
|
|
13858
|
-
_context6.next =
|
|
13896
|
+
if (!_this25.vuexLocalforage) {
|
|
13897
|
+
_context6.next = 17;
|
|
13859
13898
|
break;
|
|
13860
13899
|
}
|
|
13861
|
-
if (!
|
|
13862
|
-
_context6.next =
|
|
13900
|
+
if (!_this25.item.id) {
|
|
13901
|
+
_context6.next = 11;
|
|
13863
13902
|
break;
|
|
13864
13903
|
}
|
|
13865
|
-
_context6.next =
|
|
13866
|
-
return
|
|
13867
|
-
case
|
|
13904
|
+
_context6.next = 7;
|
|
13905
|
+
return _this25.model.$update(_this25.item.id, _this25.item);
|
|
13906
|
+
case 7:
|
|
13868
13907
|
result = _context6.sent;
|
|
13869
13908
|
create = false;
|
|
13870
|
-
_context6.next =
|
|
13909
|
+
_context6.next = 15;
|
|
13871
13910
|
break;
|
|
13911
|
+
case 11:
|
|
13912
|
+
_context6.next = 13;
|
|
13913
|
+
return _this25.model.$create(_this25.item);
|
|
13872
13914
|
case 13:
|
|
13873
|
-
_context6.next = 15;
|
|
13874
|
-
return _this23.model.$create(jsondata);
|
|
13875
|
-
case 15:
|
|
13876
13915
|
result = _context6.sent;
|
|
13877
13916
|
create = true;
|
|
13878
|
-
case
|
|
13917
|
+
case 15:
|
|
13879
13918
|
_context6.next = 36;
|
|
13880
13919
|
break;
|
|
13881
|
-
case
|
|
13882
|
-
|
|
13920
|
+
case 17:
|
|
13921
|
+
jsondata = _this25.item.$toJson();
|
|
13922
|
+
console.debug("save item 2", _this25.item, jsondata);
|
|
13923
|
+
if (!_this25.item.id) {
|
|
13883
13924
|
_context6.next = 26;
|
|
13884
13925
|
break;
|
|
13885
13926
|
}
|
|
13886
13927
|
_context6.next = 22;
|
|
13887
|
-
return
|
|
13928
|
+
return _this25.model.api().put('/' + _this25.item.id, jsondata);
|
|
13888
13929
|
case 22:
|
|
13889
13930
|
result = _context6.sent;
|
|
13890
13931
|
create = false;
|
|
@@ -13892,7 +13933,7 @@ n(css, {});function normalizeComponent (
|
|
|
13892
13933
|
break;
|
|
13893
13934
|
case 26:
|
|
13894
13935
|
_context6.next = 28;
|
|
13895
|
-
return
|
|
13936
|
+
return _this25.model.api().post('', jsondata);
|
|
13896
13937
|
case 28:
|
|
13897
13938
|
result = _context6.sent;
|
|
13898
13939
|
create = true;
|
|
@@ -13902,17 +13943,17 @@ n(css, {});function normalizeComponent (
|
|
|
13902
13943
|
_context6.next = 35;
|
|
13903
13944
|
break;
|
|
13904
13945
|
}
|
|
13905
|
-
|
|
13906
|
-
|
|
13946
|
+
_this25.toastError(result.response.data.error);
|
|
13947
|
+
_this25.loading = false;
|
|
13907
13948
|
return _context6.abrupt("return");
|
|
13908
13949
|
case 35:
|
|
13909
13950
|
result.save();
|
|
13910
13951
|
case 36:
|
|
13911
|
-
if (
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
if (
|
|
13915
|
-
|
|
13952
|
+
if (_this25.refreshAfterSave) _this25.refresh();
|
|
13953
|
+
_this25.loading = false;
|
|
13954
|
+
_this25.toastSuccess("Elemento Modificado");
|
|
13955
|
+
if (_this25.hideModalAfterSave || create && _this25.hideModalAfterCreate || !create && _this25.hideModalAfterUpdate) {
|
|
13956
|
+
_this25.$bvModal.hide("modal-form-item-" + _this25.modelName);
|
|
13916
13957
|
}
|
|
13917
13958
|
case 40:
|
|
13918
13959
|
case "end":
|
|
@@ -13922,36 +13963,36 @@ n(css, {});function normalizeComponent (
|
|
|
13922
13963
|
}))();
|
|
13923
13964
|
},
|
|
13924
13965
|
saveItemLocal: function saveItemLocal() {
|
|
13925
|
-
var
|
|
13966
|
+
var _this26 = this;
|
|
13926
13967
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
13927
13968
|
var itemSave, itemIndex;
|
|
13928
13969
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
13929
13970
|
while (1) switch (_context7.prev = _context7.next) {
|
|
13930
13971
|
case 0:
|
|
13931
|
-
itemSave = JSON.parse(JSON.stringify(
|
|
13932
|
-
if (
|
|
13933
|
-
if (
|
|
13934
|
-
itemIndex =
|
|
13935
|
-
return item.id ==
|
|
13972
|
+
itemSave = JSON.parse(JSON.stringify(_this26.item));
|
|
13973
|
+
if (_this26.item.id || _this26.item.index) {
|
|
13974
|
+
if (_this26.item.id) {
|
|
13975
|
+
itemIndex = _this26.items.findIndex(function (item) {
|
|
13976
|
+
return item.id == _this26.item.id;
|
|
13936
13977
|
});
|
|
13937
13978
|
} else {
|
|
13938
|
-
itemIndex =
|
|
13939
|
-
return item.index ==
|
|
13979
|
+
itemIndex = _this26.items.findIndex(function (item) {
|
|
13980
|
+
return item.index == _this26.item.index;
|
|
13940
13981
|
});
|
|
13941
13982
|
}
|
|
13942
|
-
|
|
13943
|
-
if (
|
|
13944
|
-
|
|
13983
|
+
_this26.items[itemIndex] = itemSave;
|
|
13984
|
+
if (_this26.hideModalAfterSave || _this26.hideModalAfterUpdate) {
|
|
13985
|
+
_this26.$bvModal.hide("modal-form-item-" + _this26.modelName);
|
|
13945
13986
|
}
|
|
13946
13987
|
} else {
|
|
13947
|
-
itemSave.index =
|
|
13948
|
-
|
|
13949
|
-
if (
|
|
13950
|
-
|
|
13988
|
+
itemSave.index = _this26.items.length + 1;
|
|
13989
|
+
_this26.items.push(itemSave);
|
|
13990
|
+
if (_this26.hideModalAfterSave || _this26.hideModalAfterCreate) {
|
|
13991
|
+
_this26.$bvModal.hide("modal-form-item-" + _this26.modelName);
|
|
13951
13992
|
}
|
|
13952
13993
|
}
|
|
13953
|
-
|
|
13954
|
-
|
|
13994
|
+
_this26.toastSuccess("Elemento Modificado");
|
|
13995
|
+
_this26.loading = false;
|
|
13955
13996
|
case 5:
|
|
13956
13997
|
case "end":
|
|
13957
13998
|
return _context7.stop();
|
|
@@ -13960,7 +14001,7 @@ n(css, {});function normalizeComponent (
|
|
|
13960
14001
|
}))();
|
|
13961
14002
|
},
|
|
13962
14003
|
loadOptions: function loadOptions() {
|
|
13963
|
-
var
|
|
14004
|
+
var _this27 = this;
|
|
13964
14005
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
13965
14006
|
var i, column, options;
|
|
13966
14007
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
@@ -13968,11 +14009,11 @@ n(css, {});function normalizeComponent (
|
|
|
13968
14009
|
case 0:
|
|
13969
14010
|
i = 0;
|
|
13970
14011
|
case 1:
|
|
13971
|
-
if (!(i <
|
|
14012
|
+
if (!(i < _this27.columns.length)) {
|
|
13972
14013
|
_context8.next = 12;
|
|
13973
14014
|
break;
|
|
13974
14015
|
}
|
|
13975
|
-
column =
|
|
14016
|
+
column = _this27.columns[i];
|
|
13976
14017
|
if (!(column.options instanceof Promise)) {
|
|
13977
14018
|
_context8.next = 9;
|
|
13978
14019
|
break;
|
|
@@ -13981,16 +14022,16 @@ n(css, {});function normalizeComponent (
|
|
|
13981
14022
|
return column.options;
|
|
13982
14023
|
case 6:
|
|
13983
14024
|
options = _context8.sent;
|
|
13984
|
-
|
|
14025
|
+
_this27.$set(_this27.columns, i, _objectSpread2(_objectSpread2({}, column), {}, {
|
|
13985
14026
|
options: options
|
|
13986
14027
|
}));
|
|
13987
|
-
console.debug("Options promise",
|
|
14028
|
+
console.debug("Options promise", _this27.columns);
|
|
13988
14029
|
case 9:
|
|
13989
14030
|
i++;
|
|
13990
14031
|
_context8.next = 1;
|
|
13991
14032
|
break;
|
|
13992
14033
|
case 12:
|
|
13993
|
-
|
|
14034
|
+
_this27.optionsLoaded = true;
|
|
13994
14035
|
case 13:
|
|
13995
14036
|
case "end":
|
|
13996
14037
|
return _context8.stop();
|
|
@@ -14000,25 +14041,25 @@ n(css, {});function normalizeComponent (
|
|
|
14000
14041
|
},
|
|
14001
14042
|
saveItem: function saveItem() {
|
|
14002
14043
|
var _arguments4 = arguments,
|
|
14003
|
-
|
|
14044
|
+
_this28 = this;
|
|
14004
14045
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
14005
14046
|
var event, validation_result, validation_error_message, formData;
|
|
14006
14047
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
14007
14048
|
while (1) switch (_context9.prev = _context9.next) {
|
|
14008
14049
|
case 0:
|
|
14009
14050
|
event = _arguments4.length > 0 && _arguments4[0] !== undefined ? _arguments4[0] : null;
|
|
14010
|
-
|
|
14011
|
-
if (!
|
|
14051
|
+
_this28.loading = true;
|
|
14052
|
+
if (!_this28.validate) {
|
|
14012
14053
|
_context9.next = 10;
|
|
14013
14054
|
break;
|
|
14014
14055
|
}
|
|
14015
14056
|
validation_result = true;
|
|
14016
|
-
validation_error_message =
|
|
14057
|
+
validation_error_message = _this28.messageDefaultValidationError;
|
|
14017
14058
|
if (validation_result) {
|
|
14018
14059
|
_context9.next = 8;
|
|
14019
14060
|
break;
|
|
14020
14061
|
}
|
|
14021
|
-
|
|
14062
|
+
_this28.toastError(validation_error_message);
|
|
14022
14063
|
return _context9.abrupt("return");
|
|
14023
14064
|
case 8:
|
|
14024
14065
|
_context9.next = 11;
|
|
@@ -14026,105 +14067,105 @@ n(css, {});function normalizeComponent (
|
|
|
14026
14067
|
case 10:
|
|
14027
14068
|
if (event) event.preventDefault();
|
|
14028
14069
|
case 11:
|
|
14029
|
-
if (!
|
|
14070
|
+
if (!_this28.useVuexORM) {
|
|
14030
14071
|
_context9.next = 13;
|
|
14031
14072
|
break;
|
|
14032
14073
|
}
|
|
14033
|
-
return _context9.abrupt("return",
|
|
14074
|
+
return _context9.abrupt("return", _this28.saveItemVuex(event));
|
|
14034
14075
|
case 13:
|
|
14035
|
-
if (
|
|
14076
|
+
if (_this28.ajax) {
|
|
14036
14077
|
_context9.next = 15;
|
|
14037
14078
|
break;
|
|
14038
14079
|
}
|
|
14039
|
-
return _context9.abrupt("return",
|
|
14080
|
+
return _context9.abrupt("return", _this28.saveItemLocal(event));
|
|
14040
14081
|
case 15:
|
|
14041
|
-
if (
|
|
14042
|
-
axios.put(
|
|
14043
|
-
if (
|
|
14044
|
-
|
|
14082
|
+
if (_this28.item.id) {
|
|
14083
|
+
axios.put(_this28.apiUrl + "/" + _this28.modelName + "/" + _this28.item.id, _this28.item).then(function (response) {
|
|
14084
|
+
if (_this28.hideModalAfterSave || _this28.hideModalAfterUpdate) {
|
|
14085
|
+
_this28.$bvModal.hide("modal-form-item-" + _this28.modelName);
|
|
14045
14086
|
}
|
|
14046
14087
|
var itemSv = response.data;
|
|
14047
|
-
var itemIndex =
|
|
14048
|
-
return item.id ==
|
|
14088
|
+
var itemIndex = _this28.items.findIndex(function (item) {
|
|
14089
|
+
return item.id == _this28.item.id;
|
|
14049
14090
|
});
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
if (
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
item:
|
|
14091
|
+
_this28.items[itemIndex] = itemSv;
|
|
14092
|
+
_this28.item = itemSv;
|
|
14093
|
+
_this28.loading = false;
|
|
14094
|
+
if (_this28.refreshAfterSave) _this28.refresh();
|
|
14095
|
+
_this28.toastSuccess("Elemento Modificado");
|
|
14096
|
+
_this28.$emit("itemSaved", {
|
|
14097
|
+
item: _this28.item
|
|
14057
14098
|
});
|
|
14058
|
-
|
|
14059
|
-
item:
|
|
14099
|
+
_this28.$emit("itemUpdated", {
|
|
14100
|
+
item: _this28.item
|
|
14060
14101
|
});
|
|
14061
14102
|
}).catch(function (error) {
|
|
14062
|
-
|
|
14063
|
-
|
|
14103
|
+
_this28.toastError(error);
|
|
14104
|
+
_this28.loading = false;
|
|
14064
14105
|
});
|
|
14065
14106
|
} else {
|
|
14066
|
-
if (
|
|
14107
|
+
if (_this28.createMultipart) {
|
|
14067
14108
|
formData = new FormData();
|
|
14068
|
-
Object.keys(
|
|
14069
|
-
if (
|
|
14070
|
-
var files =
|
|
14109
|
+
Object.keys(_this28.item).forEach(function (key) {
|
|
14110
|
+
if (_this28.item[key][0] && _this28.item[key][0].name) {
|
|
14111
|
+
var files = _this28.item[key];
|
|
14071
14112
|
for (var x = 0; x < files.length; x++) {
|
|
14072
|
-
formData.append(key + "[]",
|
|
14113
|
+
formData.append(key + "[]", _this28.item[key][x], _this28.item[key][x].name);
|
|
14073
14114
|
}
|
|
14074
|
-
} else formData.append(key,
|
|
14115
|
+
} else formData.append(key, _this28.item[key]);
|
|
14075
14116
|
});
|
|
14076
|
-
axios.post(
|
|
14077
|
-
|
|
14078
|
-
if (
|
|
14079
|
-
|
|
14117
|
+
axios.post(_this28.apiUrl + "/" + _this28.modelName, formData).then(function (response) {
|
|
14118
|
+
_this28.loading = false;
|
|
14119
|
+
if (_this28.hideModalAfterSave || _this28.hideModalAfterCreate) {
|
|
14120
|
+
_this28.$bvModal.hide("modal-form-item-" + _this28.modelName);
|
|
14080
14121
|
}
|
|
14081
14122
|
if (response.data.success) {
|
|
14082
14123
|
if (response.data.message) {
|
|
14083
|
-
|
|
14124
|
+
_this28.toastSuccess(response.data.message);
|
|
14084
14125
|
}
|
|
14085
14126
|
return;
|
|
14086
14127
|
}
|
|
14087
14128
|
var itemSv = response.data;
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
if (
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
item:
|
|
14129
|
+
_this28.items.push(itemSv);
|
|
14130
|
+
_this28.item = itemSv;
|
|
14131
|
+
if (_this28.refreshAfterSave) _this28.refresh();
|
|
14132
|
+
_this28.toastSuccess("Elemento Creado");
|
|
14133
|
+
_this28.$emit("itemSaved", {
|
|
14134
|
+
item: _this28.item
|
|
14094
14135
|
});
|
|
14095
|
-
|
|
14096
|
-
item:
|
|
14136
|
+
_this28.$emit("itemCreated", {
|
|
14137
|
+
item: _this28.item
|
|
14097
14138
|
});
|
|
14098
14139
|
}).catch(function (error) {
|
|
14099
|
-
|
|
14100
|
-
|
|
14140
|
+
_this28.toastError(error);
|
|
14141
|
+
_this28.loading = false;
|
|
14101
14142
|
});
|
|
14102
14143
|
} else {
|
|
14103
|
-
axios.post(
|
|
14104
|
-
|
|
14105
|
-
if (
|
|
14106
|
-
|
|
14144
|
+
axios.post(_this28.apiUrl + "/" + _this28.modelName, _this28.item).then(function (response) {
|
|
14145
|
+
_this28.loading = false;
|
|
14146
|
+
if (_this28.hideModalAfterSave || _this28.hideModalAfterUpdate) {
|
|
14147
|
+
_this28.$bvModal.hide("modal-form-item-" + _this28.modelName);
|
|
14107
14148
|
}
|
|
14108
14149
|
if (response.data.success) {
|
|
14109
14150
|
if (response.data.message) {
|
|
14110
|
-
|
|
14151
|
+
_this28.toastSuccess(response.data.message);
|
|
14111
14152
|
}
|
|
14112
14153
|
return;
|
|
14113
14154
|
}
|
|
14114
14155
|
var itemSv = response.data;
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
if (
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
item:
|
|
14156
|
+
_this28.items.push(itemSv);
|
|
14157
|
+
_this28.item = itemSv;
|
|
14158
|
+
if (_this28.refreshAfterSave) _this28.refresh();
|
|
14159
|
+
_this28.toastSuccess("Elemento Creado");
|
|
14160
|
+
_this28.$emit("itemSaved", {
|
|
14161
|
+
item: _this28.item
|
|
14121
14162
|
});
|
|
14122
|
-
|
|
14123
|
-
item:
|
|
14163
|
+
_this28.$emit("itemCreated", {
|
|
14164
|
+
item: _this28.item
|
|
14124
14165
|
});
|
|
14125
14166
|
}).catch(function (error) {
|
|
14126
|
-
|
|
14127
|
-
|
|
14167
|
+
_this28.toastError(error);
|
|
14168
|
+
_this28.loading = false;
|
|
14128
14169
|
});
|
|
14129
14170
|
}
|
|
14130
14171
|
}
|
|
@@ -14212,11 +14253,11 @@ n(css, {});function normalizeComponent (
|
|
|
14212
14253
|
link.click();
|
|
14213
14254
|
},
|
|
14214
14255
|
onChangeFilter: function onChangeFilter(event) {
|
|
14215
|
-
var
|
|
14256
|
+
var _this29 = this;
|
|
14216
14257
|
this.forceRecomputeCounter++;
|
|
14217
14258
|
console.debug("Filters debug ", this.finalFilters, this.internalFilter, this.internalFilters, this.filter, this.filters);
|
|
14218
14259
|
setTimeout(function () {
|
|
14219
|
-
|
|
14260
|
+
_this29.refresh();
|
|
14220
14261
|
}, 1);
|
|
14221
14262
|
},
|
|
14222
14263
|
onPaginationChange: function onPaginationChange(page) {
|
|
@@ -15278,7 +15319,7 @@ var _sfc_render = function render() {
|
|
|
15278
15319
|
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
15279
15320
|
};
|
|
15280
15321
|
var _sfc_staticRenderFns = [];
|
|
15281
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
15322
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "e8340149", null, null);
|
|
15282
15323
|
var component$1 = __component__.exports;// Import vue component
|
|
15283
15324
|
|
|
15284
15325
|
// Default export is installable instance of component.
|