vue-laravel-crud 1.6.6 → 1.6.8
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 +79 -3
- package/dist/vue-laravel-crud.min.js +2 -2
- package/dist/vue-laravel-crud.ssr.js +292 -186
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +80 -1
|
@@ -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-d24c9f33]:last-child,\ntr td[data-v-d24c9f33]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-d24c9f33] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-d24c9f33] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-d24c9f33] .crud-title[data-v-d24c9f33] {\n margin: 0; }\n .crud-header[data-v-d24c9f33] .crud-search[data-v-d24c9f33] {\n max-width: 15rem; }\n .crud-header[data-v-d24c9f33] .crud-search[data-v-d24c9f33] .btn[data-v-d24c9f33] {\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-d24c9f33] .crud-search[data-v-d24c9f33] .btn[data-v-d24c9f33].open[data-v-d24c9f33] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-d24c9f33] .table-options[data-v-d24c9f33] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-d24c9f33] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-d24c9f33] {\n table-layout: auto; }\n .table[data-v-d24c9f33] tbody[data-v-d24c9f33] td[data-v-d24c9f33] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-d24c9f33] tbody[data-v-d24c9f33] td[data-v-d24c9f33]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12536
12536
|
n(css, {});function normalizeComponent (
|
|
12537
12537
|
scriptExports,
|
|
12538
12538
|
render,
|
|
@@ -12950,6 +12950,10 @@ n(css, {});function normalizeComponent (
|
|
|
12950
12950
|
principalSortColumn: {
|
|
12951
12951
|
type: String,
|
|
12952
12952
|
default: "id"
|
|
12953
|
+
},
|
|
12954
|
+
bulkDelete: {
|
|
12955
|
+
type: Boolean,
|
|
12956
|
+
default: false
|
|
12953
12957
|
}
|
|
12954
12958
|
},
|
|
12955
12959
|
mounted: function mounted() {
|
|
@@ -13448,8 +13452,101 @@ n(css, {});function normalizeComponent (
|
|
|
13448
13452
|
_this12.loading = false;
|
|
13449
13453
|
});
|
|
13450
13454
|
},
|
|
13451
|
-
|
|
13455
|
+
confirmBulkDelete: function confirmBulkDelete() {
|
|
13452
13456
|
var _this13 = this;
|
|
13457
|
+
this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
|
|
13458
|
+
size: "sm",
|
|
13459
|
+
buttonSize: "sm",
|
|
13460
|
+
okVariant: "danger",
|
|
13461
|
+
okTitle: this.messageRemove,
|
|
13462
|
+
cancelTitle: "NO",
|
|
13463
|
+
centered: true
|
|
13464
|
+
}).then(function (value) {
|
|
13465
|
+
if (value) {
|
|
13466
|
+
_this13.deleteItemBulk();
|
|
13467
|
+
}
|
|
13468
|
+
}).catch(function (error) {
|
|
13469
|
+
_this13.toastError(error);
|
|
13470
|
+
_this13.loading = false;
|
|
13471
|
+
});
|
|
13472
|
+
},
|
|
13473
|
+
deleteItemBulk: function deleteItemBulk() {
|
|
13474
|
+
var _this14 = this;
|
|
13475
|
+
if (this.useVuexORM) {
|
|
13476
|
+
return this.deleteItemBulkVuex();
|
|
13477
|
+
}
|
|
13478
|
+
if (!this.ajax) {
|
|
13479
|
+
return this.deleteItemBulkLocal();
|
|
13480
|
+
}
|
|
13481
|
+
var ids = this.selectedItems.map(function (it) {
|
|
13482
|
+
return it.id;
|
|
13483
|
+
});
|
|
13484
|
+
this.loading = true;
|
|
13485
|
+
axios.delete(this.apiUrl + "/" + this.modelName + "/bulk-destroy", {
|
|
13486
|
+
ids: ids
|
|
13487
|
+
}).then(function (response) {
|
|
13488
|
+
_this14.items = _this14.items.filter(function (it) {
|
|
13489
|
+
return ids.includes(it.id);
|
|
13490
|
+
});
|
|
13491
|
+
_this14.toastSuccess("Elemento/s eliminado.");
|
|
13492
|
+
_this14.$emit("itemDeleted", {});
|
|
13493
|
+
_this14.loading = false;
|
|
13494
|
+
}).catch(function (error) {
|
|
13495
|
+
_this14.toastError(error);
|
|
13496
|
+
_this14.loading = false;
|
|
13497
|
+
});
|
|
13498
|
+
},
|
|
13499
|
+
deleteItemBulkLocal: function deleteItemBulkLocal() {
|
|
13500
|
+
var _this15 = this;
|
|
13501
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
13502
|
+
var ids;
|
|
13503
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
13504
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13505
|
+
case 0:
|
|
13506
|
+
ids = _this15.selectedItems.map(function (it) {
|
|
13507
|
+
return it.id;
|
|
13508
|
+
});
|
|
13509
|
+
_this15.items = _this15.items.filter(function (it) {
|
|
13510
|
+
return ids.includes(it.id);
|
|
13511
|
+
});
|
|
13512
|
+
_this15.item = null;
|
|
13513
|
+
_this15.toastSuccess("Elemento Eliminado");
|
|
13514
|
+
_this15.$emit("itemDeleted", {});
|
|
13515
|
+
_this15.loading = false;
|
|
13516
|
+
case 6:
|
|
13517
|
+
case "end":
|
|
13518
|
+
return _context2.stop();
|
|
13519
|
+
}
|
|
13520
|
+
}, _callee2);
|
|
13521
|
+
}))();
|
|
13522
|
+
},
|
|
13523
|
+
deleteItemBulkVuex: function deleteItemBulkVuex() {
|
|
13524
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
13525
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
13526
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13527
|
+
case 0:
|
|
13528
|
+
case "end":
|
|
13529
|
+
return _context3.stop();
|
|
13530
|
+
}
|
|
13531
|
+
}, _callee3);
|
|
13532
|
+
}))();
|
|
13533
|
+
} /*
|
|
13534
|
+
let result = await this.model.api().delete('/' + id, {
|
|
13535
|
+
delete: 1
|
|
13536
|
+
});
|
|
13537
|
+
|
|
13538
|
+
console.debug("delete item vuex", result);
|
|
13539
|
+
let responseStatus = result.response.status;
|
|
13540
|
+
|
|
13541
|
+
if (result.response.data.error) {
|
|
13542
|
+
this.toastError(result.response.data.error);
|
|
13543
|
+
this.loading = false;
|
|
13544
|
+
return;
|
|
13545
|
+
}
|
|
13546
|
+
|
|
13547
|
+
this.toastSuccess("Elemento eliminado.");*/,
|
|
13548
|
+
deleteItem: function deleteItem(id, index) {
|
|
13549
|
+
var _this16 = this;
|
|
13453
13550
|
if (this.useVuexORM) {
|
|
13454
13551
|
return this.deleteItemVuex(id, index);
|
|
13455
13552
|
}
|
|
@@ -13458,89 +13555,89 @@ n(css, {});function normalizeComponent (
|
|
|
13458
13555
|
}
|
|
13459
13556
|
this.loading = true;
|
|
13460
13557
|
axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(function (response) {
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13558
|
+
_this16.items.splice(index, 1);
|
|
13559
|
+
_this16.toastSuccess("Elemento eliminado.");
|
|
13560
|
+
_this16.$emit("itemDeleted", {});
|
|
13561
|
+
_this16.loading = false;
|
|
13465
13562
|
}).catch(function (error) {
|
|
13466
|
-
|
|
13467
|
-
|
|
13563
|
+
_this16.toastError(error);
|
|
13564
|
+
_this16.loading = false;
|
|
13468
13565
|
});
|
|
13469
13566
|
},
|
|
13470
13567
|
deleteItemLocal: function deleteItemLocal(id, index) {
|
|
13471
|
-
var
|
|
13472
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
13568
|
+
var _this17 = this;
|
|
13569
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
13473
13570
|
var itemIndex;
|
|
13474
|
-
return _regeneratorRuntime().wrap(function
|
|
13475
|
-
while (1) switch (
|
|
13571
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
13572
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
13476
13573
|
case 0:
|
|
13477
13574
|
if (id || index) {
|
|
13478
13575
|
if (id) {
|
|
13479
|
-
itemIndex =
|
|
13480
|
-
return item.id ==
|
|
13576
|
+
itemIndex = _this17.items.findIndex(function (item) {
|
|
13577
|
+
return item.id == _this17.item.id;
|
|
13481
13578
|
});
|
|
13482
13579
|
} else {
|
|
13483
13580
|
itemIndex = index;
|
|
13484
13581
|
}
|
|
13485
13582
|
|
|
13486
13583
|
// Assuming this.items is an array
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13584
|
+
_this17.items.splice(itemIndex, 1);
|
|
13585
|
+
_this17.item = null;
|
|
13586
|
+
_this17.toastSuccess("Elemento Eliminado");
|
|
13587
|
+
_this17.$emit("itemDeleted", {});
|
|
13491
13588
|
} else {
|
|
13492
13589
|
// Handle the case where there's no item.id or item.index
|
|
13493
13590
|
console.error("Cannot delete item without ID or index");
|
|
13494
13591
|
// You might want to show an error message or handle it in a way that fits your application.
|
|
13495
13592
|
}
|
|
13496
|
-
|
|
13593
|
+
_this17.loading = false;
|
|
13497
13594
|
case 2:
|
|
13498
13595
|
case "end":
|
|
13499
|
-
return
|
|
13596
|
+
return _context4.stop();
|
|
13500
13597
|
}
|
|
13501
|
-
},
|
|
13598
|
+
}, _callee4);
|
|
13502
13599
|
}))();
|
|
13503
13600
|
},
|
|
13504
13601
|
deleteItemVuex: function deleteItemVuex(id, index) {
|
|
13505
|
-
var
|
|
13506
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
13602
|
+
var _this18 = this;
|
|
13603
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
13507
13604
|
var result;
|
|
13508
|
-
return _regeneratorRuntime().wrap(function
|
|
13509
|
-
while (1) switch (
|
|
13605
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
13606
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13510
13607
|
case 0:
|
|
13511
|
-
|
|
13512
|
-
return
|
|
13608
|
+
_context5.next = 2;
|
|
13609
|
+
return _this18.model.api().delete('/' + id, {
|
|
13513
13610
|
delete: 1
|
|
13514
13611
|
});
|
|
13515
13612
|
case 2:
|
|
13516
|
-
result =
|
|
13613
|
+
result = _context5.sent;
|
|
13517
13614
|
console.debug("delete item vuex", result);
|
|
13518
13615
|
result.response.status;
|
|
13519
13616
|
if (!result.response.data.error) {
|
|
13520
|
-
|
|
13617
|
+
_context5.next = 9;
|
|
13521
13618
|
break;
|
|
13522
13619
|
}
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
return
|
|
13620
|
+
_this18.toastError(result.response.data.error);
|
|
13621
|
+
_this18.loading = false;
|
|
13622
|
+
return _context5.abrupt("return");
|
|
13526
13623
|
case 9:
|
|
13527
|
-
|
|
13624
|
+
_this18.toastSuccess("Elemento eliminado.");
|
|
13528
13625
|
case 10:
|
|
13529
13626
|
case "end":
|
|
13530
|
-
return
|
|
13627
|
+
return _context5.stop();
|
|
13531
13628
|
}
|
|
13532
|
-
},
|
|
13629
|
+
}, _callee5);
|
|
13533
13630
|
}))();
|
|
13534
13631
|
},
|
|
13535
13632
|
saveSort: function saveSort() {
|
|
13536
|
-
var
|
|
13633
|
+
var _this19 = this;
|
|
13537
13634
|
if (this.orderable) {
|
|
13538
13635
|
this.loading = true;
|
|
13539
13636
|
var order = [];
|
|
13540
13637
|
this.items.forEach(function (v, k) {
|
|
13541
13638
|
order.push({
|
|
13542
13639
|
id: v.id,
|
|
13543
|
-
order: v[
|
|
13640
|
+
order: v[_this19.orderProp]
|
|
13544
13641
|
});
|
|
13545
13642
|
});
|
|
13546
13643
|
if (!this.ajax) {
|
|
@@ -13550,18 +13647,18 @@ n(css, {});function normalizeComponent (
|
|
|
13550
13647
|
order: order
|
|
13551
13648
|
}).then(function (response) {
|
|
13552
13649
|
response.data;
|
|
13553
|
-
|
|
13554
|
-
if (
|
|
13555
|
-
|
|
13650
|
+
_this19.toastSuccess("Orden Actualizado");
|
|
13651
|
+
if (_this19.refreshAfterSave) _this19.refresh();
|
|
13652
|
+
_this19.loading = false;
|
|
13556
13653
|
}).catch(function (error) {
|
|
13557
13654
|
//console.debug(error);
|
|
13558
|
-
|
|
13559
|
-
|
|
13655
|
+
_this19.toastError(error);
|
|
13656
|
+
_this19.loading = false;
|
|
13560
13657
|
});
|
|
13561
13658
|
}
|
|
13562
13659
|
},
|
|
13563
13660
|
getArrayValue: function getArrayValue(value, displayProp) {
|
|
13564
|
-
var
|
|
13661
|
+
var _this20 = this;
|
|
13565
13662
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
13566
13663
|
if (!Array.isArray(value)) return "N/A";
|
|
13567
13664
|
var values = [];
|
|
@@ -13578,7 +13675,7 @@ n(css, {});function normalizeComponent (
|
|
|
13578
13675
|
return "";
|
|
13579
13676
|
}
|
|
13580
13677
|
values.forEach(function (val) {
|
|
13581
|
-
valuesFinal.push(
|
|
13678
|
+
valuesFinal.push(_this20.getStateValue(val, options));
|
|
13582
13679
|
});
|
|
13583
13680
|
return values.join(",");
|
|
13584
13681
|
},
|
|
@@ -13600,270 +13697,270 @@ n(css, {});function normalizeComponent (
|
|
|
13600
13697
|
return ops.join(", ");
|
|
13601
13698
|
},
|
|
13602
13699
|
saveItemVuex: function saveItemVuex() {
|
|
13603
|
-
var
|
|
13604
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
13700
|
+
var _this21 = this;
|
|
13701
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
13605
13702
|
var jsondata, result, create;
|
|
13606
|
-
return _regeneratorRuntime().wrap(function
|
|
13607
|
-
while (1) switch (
|
|
13703
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
13704
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
13608
13705
|
case 0:
|
|
13609
|
-
console.debug("save item 1",
|
|
13610
|
-
jsondata =
|
|
13611
|
-
console.debug("save item 2",
|
|
13706
|
+
console.debug("save item 1", _this21.item);
|
|
13707
|
+
jsondata = _this21.item.$toJson();
|
|
13708
|
+
console.debug("save item 2", _this21.item, jsondata);
|
|
13612
13709
|
create = false;
|
|
13613
|
-
if (!
|
|
13614
|
-
|
|
13710
|
+
if (!_this21.item.id) {
|
|
13711
|
+
_context6.next = 12;
|
|
13615
13712
|
break;
|
|
13616
13713
|
}
|
|
13617
|
-
|
|
13618
|
-
return
|
|
13714
|
+
_context6.next = 8;
|
|
13715
|
+
return _this21.model.api().put('/' + _this21.item.id, jsondata);
|
|
13619
13716
|
case 8:
|
|
13620
|
-
result =
|
|
13717
|
+
result = _context6.sent;
|
|
13621
13718
|
create = false;
|
|
13622
|
-
|
|
13719
|
+
_context6.next = 16;
|
|
13623
13720
|
break;
|
|
13624
13721
|
case 12:
|
|
13625
|
-
|
|
13626
|
-
return
|
|
13722
|
+
_context6.next = 14;
|
|
13723
|
+
return _this21.model.api().post('', jsondata);
|
|
13627
13724
|
case 14:
|
|
13628
|
-
result =
|
|
13725
|
+
result = _context6.sent;
|
|
13629
13726
|
create = true;
|
|
13630
13727
|
case 16:
|
|
13631
13728
|
result.response.status;
|
|
13632
13729
|
if (!result.response.data.error) {
|
|
13633
|
-
|
|
13730
|
+
_context6.next = 21;
|
|
13634
13731
|
break;
|
|
13635
13732
|
}
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
return
|
|
13733
|
+
_this21.toastError(result.response.data.error);
|
|
13734
|
+
_this21.loading = false;
|
|
13735
|
+
return _context6.abrupt("return");
|
|
13639
13736
|
case 21:
|
|
13640
13737
|
result.save();
|
|
13641
|
-
if (
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
if (
|
|
13645
|
-
|
|
13738
|
+
if (_this21.refreshAfterSave) _this21.refresh();
|
|
13739
|
+
_this21.loading = false;
|
|
13740
|
+
_this21.toastSuccess("Elemento Modificado");
|
|
13741
|
+
if (_this21.hideModalAfterSave || create && _this21.hideModalAfterCreate || !create && _this21.hideModalAfterUpdate) {
|
|
13742
|
+
_this21.$bvModal.hide("modal-form-item-" + _this21.modelName);
|
|
13646
13743
|
}
|
|
13647
13744
|
case 26:
|
|
13648
13745
|
case "end":
|
|
13649
|
-
return
|
|
13746
|
+
return _context6.stop();
|
|
13650
13747
|
}
|
|
13651
|
-
},
|
|
13748
|
+
}, _callee6);
|
|
13652
13749
|
}))();
|
|
13653
13750
|
},
|
|
13654
13751
|
saveItemLocal: function saveItemLocal() {
|
|
13655
|
-
var
|
|
13656
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
13752
|
+
var _this22 = this;
|
|
13753
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
13657
13754
|
var itemSave, itemIndex;
|
|
13658
|
-
return _regeneratorRuntime().wrap(function
|
|
13659
|
-
while (1) switch (
|
|
13755
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
13756
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
13660
13757
|
case 0:
|
|
13661
|
-
itemSave = JSON.parse(JSON.stringify(
|
|
13662
|
-
if (
|
|
13663
|
-
if (
|
|
13664
|
-
itemIndex =
|
|
13665
|
-
return item.id ==
|
|
13758
|
+
itemSave = JSON.parse(JSON.stringify(_this22.item));
|
|
13759
|
+
if (_this22.item.id || _this22.item.index) {
|
|
13760
|
+
if (_this22.item.id) {
|
|
13761
|
+
itemIndex = _this22.items.findIndex(function (item) {
|
|
13762
|
+
return item.id == _this22.item.id;
|
|
13666
13763
|
});
|
|
13667
13764
|
} else {
|
|
13668
|
-
itemIndex =
|
|
13669
|
-
return item.index ==
|
|
13765
|
+
itemIndex = _this22.items.findIndex(function (item) {
|
|
13766
|
+
return item.index == _this22.item.index;
|
|
13670
13767
|
});
|
|
13671
13768
|
}
|
|
13672
|
-
|
|
13673
|
-
if (
|
|
13674
|
-
|
|
13769
|
+
_this22.items[itemIndex] = itemSave;
|
|
13770
|
+
if (_this22.hideModalAfterSave || _this22.hideModalAfterUpdate) {
|
|
13771
|
+
_this22.$bvModal.hide("modal-form-item-" + _this22.modelName);
|
|
13675
13772
|
}
|
|
13676
13773
|
} else {
|
|
13677
|
-
itemSave.index =
|
|
13678
|
-
|
|
13679
|
-
if (
|
|
13680
|
-
|
|
13774
|
+
itemSave.index = _this22.items.length + 1;
|
|
13775
|
+
_this22.items.push(itemSave);
|
|
13776
|
+
if (_this22.hideModalAfterSave || _this22.hideModalAfterCreate) {
|
|
13777
|
+
_this22.$bvModal.hide("modal-form-item-" + _this22.modelName);
|
|
13681
13778
|
}
|
|
13682
13779
|
}
|
|
13683
|
-
|
|
13684
|
-
|
|
13780
|
+
_this22.toastSuccess("Elemento Modificado");
|
|
13781
|
+
_this22.loading = false;
|
|
13685
13782
|
case 5:
|
|
13686
13783
|
case "end":
|
|
13687
|
-
return
|
|
13784
|
+
return _context7.stop();
|
|
13688
13785
|
}
|
|
13689
|
-
},
|
|
13786
|
+
}, _callee7);
|
|
13690
13787
|
}))();
|
|
13691
13788
|
},
|
|
13692
13789
|
loadOptions: function loadOptions() {
|
|
13693
|
-
var
|
|
13694
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
13790
|
+
var _this23 = this;
|
|
13791
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
13695
13792
|
var i, column, options;
|
|
13696
|
-
return _regeneratorRuntime().wrap(function
|
|
13697
|
-
while (1) switch (
|
|
13793
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
13794
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
13698
13795
|
case 0:
|
|
13699
13796
|
i = 0;
|
|
13700
13797
|
case 1:
|
|
13701
|
-
if (!(i <
|
|
13702
|
-
|
|
13798
|
+
if (!(i < _this23.columns.length)) {
|
|
13799
|
+
_context8.next = 12;
|
|
13703
13800
|
break;
|
|
13704
13801
|
}
|
|
13705
|
-
column =
|
|
13802
|
+
column = _this23.columns[i];
|
|
13706
13803
|
if (!(column.options instanceof Promise)) {
|
|
13707
|
-
|
|
13804
|
+
_context8.next = 9;
|
|
13708
13805
|
break;
|
|
13709
13806
|
}
|
|
13710
|
-
|
|
13807
|
+
_context8.next = 6;
|
|
13711
13808
|
return column.options;
|
|
13712
13809
|
case 6:
|
|
13713
|
-
options =
|
|
13714
|
-
|
|
13810
|
+
options = _context8.sent;
|
|
13811
|
+
_this23.$set(_this23.columns, i, _objectSpread2(_objectSpread2({}, column), {}, {
|
|
13715
13812
|
options: options
|
|
13716
13813
|
}));
|
|
13717
|
-
console.debug("Options promise",
|
|
13814
|
+
console.debug("Options promise", _this23.columns);
|
|
13718
13815
|
case 9:
|
|
13719
13816
|
i++;
|
|
13720
|
-
|
|
13817
|
+
_context8.next = 1;
|
|
13721
13818
|
break;
|
|
13722
13819
|
case 12:
|
|
13723
|
-
|
|
13820
|
+
_this23.optionsLoaded = true;
|
|
13724
13821
|
case 13:
|
|
13725
13822
|
case "end":
|
|
13726
|
-
return
|
|
13823
|
+
return _context8.stop();
|
|
13727
13824
|
}
|
|
13728
|
-
},
|
|
13825
|
+
}, _callee8);
|
|
13729
13826
|
}))();
|
|
13730
13827
|
},
|
|
13731
13828
|
saveItem: function saveItem() {
|
|
13732
13829
|
var _arguments4 = arguments,
|
|
13733
|
-
|
|
13734
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
13830
|
+
_this24 = this;
|
|
13831
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
13735
13832
|
var event, validation_result, validation_error_message, formData;
|
|
13736
|
-
return _regeneratorRuntime().wrap(function
|
|
13737
|
-
while (1) switch (
|
|
13833
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
13834
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
13738
13835
|
case 0:
|
|
13739
13836
|
event = _arguments4.length > 0 && _arguments4[0] !== undefined ? _arguments4[0] : null;
|
|
13740
|
-
|
|
13741
|
-
if (!
|
|
13742
|
-
|
|
13837
|
+
_this24.loading = true;
|
|
13838
|
+
if (!_this24.validate) {
|
|
13839
|
+
_context9.next = 10;
|
|
13743
13840
|
break;
|
|
13744
13841
|
}
|
|
13745
13842
|
validation_result = true;
|
|
13746
|
-
validation_error_message =
|
|
13843
|
+
validation_error_message = _this24.messageDefaultValidationError;
|
|
13747
13844
|
if (validation_result) {
|
|
13748
|
-
|
|
13845
|
+
_context9.next = 8;
|
|
13749
13846
|
break;
|
|
13750
13847
|
}
|
|
13751
|
-
|
|
13752
|
-
return
|
|
13848
|
+
_this24.toastError(validation_error_message);
|
|
13849
|
+
return _context9.abrupt("return");
|
|
13753
13850
|
case 8:
|
|
13754
|
-
|
|
13851
|
+
_context9.next = 11;
|
|
13755
13852
|
break;
|
|
13756
13853
|
case 10:
|
|
13757
13854
|
if (event) event.preventDefault();
|
|
13758
13855
|
case 11:
|
|
13759
|
-
if (!
|
|
13760
|
-
|
|
13856
|
+
if (!_this24.useVuexORM) {
|
|
13857
|
+
_context9.next = 13;
|
|
13761
13858
|
break;
|
|
13762
13859
|
}
|
|
13763
|
-
return
|
|
13860
|
+
return _context9.abrupt("return", _this24.saveItemVuex(event));
|
|
13764
13861
|
case 13:
|
|
13765
|
-
if (
|
|
13766
|
-
|
|
13862
|
+
if (_this24.ajax) {
|
|
13863
|
+
_context9.next = 15;
|
|
13767
13864
|
break;
|
|
13768
13865
|
}
|
|
13769
|
-
return
|
|
13866
|
+
return _context9.abrupt("return", _this24.saveItemLocal(event));
|
|
13770
13867
|
case 15:
|
|
13771
|
-
if (
|
|
13772
|
-
axios.put(
|
|
13773
|
-
if (
|
|
13774
|
-
|
|
13868
|
+
if (_this24.item.id) {
|
|
13869
|
+
axios.put(_this24.apiUrl + "/" + _this24.modelName + "/" + _this24.item.id, _this24.item).then(function (response) {
|
|
13870
|
+
if (_this24.hideModalAfterSave || _this24.hideModalAfterUpdate) {
|
|
13871
|
+
_this24.$bvModal.hide("modal-form-item-" + _this24.modelName);
|
|
13775
13872
|
}
|
|
13776
13873
|
var itemSv = response.data;
|
|
13777
|
-
var itemIndex =
|
|
13778
|
-
return item.id ==
|
|
13874
|
+
var itemIndex = _this24.items.findIndex(function (item) {
|
|
13875
|
+
return item.id == _this24.item.id;
|
|
13779
13876
|
});
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
if (
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
item:
|
|
13877
|
+
_this24.items[itemIndex] = itemSv;
|
|
13878
|
+
_this24.item = itemSv;
|
|
13879
|
+
_this24.loading = false;
|
|
13880
|
+
if (_this24.refreshAfterSave) _this24.refresh();
|
|
13881
|
+
_this24.toastSuccess("Elemento Modificado");
|
|
13882
|
+
_this24.$emit("itemSaved", {
|
|
13883
|
+
item: _this24.item
|
|
13787
13884
|
});
|
|
13788
|
-
|
|
13789
|
-
item:
|
|
13885
|
+
_this24.$emit("itemUpdated", {
|
|
13886
|
+
item: _this24.item
|
|
13790
13887
|
});
|
|
13791
13888
|
}).catch(function (error) {
|
|
13792
|
-
|
|
13793
|
-
|
|
13889
|
+
_this24.toastError(error);
|
|
13890
|
+
_this24.loading = false;
|
|
13794
13891
|
});
|
|
13795
13892
|
} else {
|
|
13796
|
-
if (
|
|
13893
|
+
if (_this24.createMultipart) {
|
|
13797
13894
|
formData = new FormData();
|
|
13798
|
-
Object.keys(
|
|
13799
|
-
if (
|
|
13800
|
-
var files =
|
|
13895
|
+
Object.keys(_this24.item).forEach(function (key) {
|
|
13896
|
+
if (_this24.item[key][0] && _this24.item[key][0].name) {
|
|
13897
|
+
var files = _this24.item[key];
|
|
13801
13898
|
for (var x = 0; x < files.length; x++) {
|
|
13802
|
-
formData.append(key + "[]",
|
|
13899
|
+
formData.append(key + "[]", _this24.item[key][x], _this24.item[key][x].name);
|
|
13803
13900
|
}
|
|
13804
|
-
} else formData.append(key,
|
|
13901
|
+
} else formData.append(key, _this24.item[key]);
|
|
13805
13902
|
});
|
|
13806
|
-
axios.post(
|
|
13807
|
-
|
|
13808
|
-
if (
|
|
13809
|
-
|
|
13903
|
+
axios.post(_this24.apiUrl + "/" + _this24.modelName, formData).then(function (response) {
|
|
13904
|
+
_this24.loading = false;
|
|
13905
|
+
if (_this24.hideModalAfterSave || _this24.hideModalAfterCreate) {
|
|
13906
|
+
_this24.$bvModal.hide("modal-form-item-" + _this24.modelName);
|
|
13810
13907
|
}
|
|
13811
13908
|
if (response.data.success) {
|
|
13812
13909
|
if (response.data.message) {
|
|
13813
|
-
|
|
13910
|
+
_this24.toastSuccess(response.data.message);
|
|
13814
13911
|
}
|
|
13815
13912
|
return;
|
|
13816
13913
|
}
|
|
13817
13914
|
var itemSv = response.data;
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
if (
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
item:
|
|
13915
|
+
_this24.items.push(itemSv);
|
|
13916
|
+
_this24.item = itemSv;
|
|
13917
|
+
if (_this24.refreshAfterSave) _this24.refresh();
|
|
13918
|
+
_this24.toastSuccess("Elemento Creado");
|
|
13919
|
+
_this24.$emit("itemSaved", {
|
|
13920
|
+
item: _this24.item
|
|
13824
13921
|
});
|
|
13825
|
-
|
|
13826
|
-
item:
|
|
13922
|
+
_this24.$emit("itemCreated", {
|
|
13923
|
+
item: _this24.item
|
|
13827
13924
|
});
|
|
13828
13925
|
}).catch(function (error) {
|
|
13829
|
-
|
|
13830
|
-
|
|
13926
|
+
_this24.toastError(error);
|
|
13927
|
+
_this24.loading = false;
|
|
13831
13928
|
});
|
|
13832
13929
|
} else {
|
|
13833
|
-
axios.post(
|
|
13834
|
-
|
|
13835
|
-
if (
|
|
13836
|
-
|
|
13930
|
+
axios.post(_this24.apiUrl + "/" + _this24.modelName, _this24.item).then(function (response) {
|
|
13931
|
+
_this24.loading = false;
|
|
13932
|
+
if (_this24.hideModalAfterSave || _this24.hideModalAfterUpdate) {
|
|
13933
|
+
_this24.$bvModal.hide("modal-form-item-" + _this24.modelName);
|
|
13837
13934
|
}
|
|
13838
13935
|
if (response.data.success) {
|
|
13839
13936
|
if (response.data.message) {
|
|
13840
|
-
|
|
13937
|
+
_this24.toastSuccess(response.data.message);
|
|
13841
13938
|
}
|
|
13842
13939
|
return;
|
|
13843
13940
|
}
|
|
13844
13941
|
var itemSv = response.data;
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
if (
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
item:
|
|
13942
|
+
_this24.items.push(itemSv);
|
|
13943
|
+
_this24.item = itemSv;
|
|
13944
|
+
if (_this24.refreshAfterSave) _this24.refresh();
|
|
13945
|
+
_this24.toastSuccess("Elemento Creado");
|
|
13946
|
+
_this24.$emit("itemSaved", {
|
|
13947
|
+
item: _this24.item
|
|
13851
13948
|
});
|
|
13852
|
-
|
|
13853
|
-
item:
|
|
13949
|
+
_this24.$emit("itemCreated", {
|
|
13950
|
+
item: _this24.item
|
|
13854
13951
|
});
|
|
13855
13952
|
}).catch(function (error) {
|
|
13856
|
-
|
|
13857
|
-
|
|
13953
|
+
_this24.toastError(error);
|
|
13954
|
+
_this24.loading = false;
|
|
13858
13955
|
});
|
|
13859
13956
|
}
|
|
13860
13957
|
}
|
|
13861
13958
|
if (event) event.preventDefault();
|
|
13862
13959
|
case 17:
|
|
13863
13960
|
case "end":
|
|
13864
|
-
return
|
|
13961
|
+
return _context9.stop();
|
|
13865
13962
|
}
|
|
13866
|
-
},
|
|
13963
|
+
}, _callee9);
|
|
13867
13964
|
}))();
|
|
13868
13965
|
},
|
|
13869
13966
|
clearItems: function clearItems() {
|
|
@@ -13922,11 +14019,11 @@ n(css, {});function normalizeComponent (
|
|
|
13922
14019
|
});
|
|
13923
14020
|
},
|
|
13924
14021
|
onChangeFilter: function onChangeFilter(event) {
|
|
13925
|
-
var
|
|
14022
|
+
var _this25 = this;
|
|
13926
14023
|
this.forceRecomputeCounter++;
|
|
13927
14024
|
console.debug("Filters debug ", this.finalFilters, this.internalFilter, this.internalFilters, this.filter, this.filters);
|
|
13928
14025
|
setTimeout(function () {
|
|
13929
|
-
|
|
14026
|
+
_this25.refresh();
|
|
13930
14027
|
}, 1);
|
|
13931
14028
|
},
|
|
13932
14029
|
onPaginationChange: function onPaginationChange(page) {
|
|
@@ -14186,7 +14283,16 @@ var _sfc_render = function render() {
|
|
|
14186
14283
|
return _vm.togglePrincipalSort();
|
|
14187
14284
|
}
|
|
14188
14285
|
}
|
|
14189
|
-
}, [_vm.principalSort ? _c('b-icon-sort-numeric-down') : _c('b-icon-sort-numeric-up')], 1) : _vm._e(), _vm.
|
|
14286
|
+
}, [_vm.principalSort ? _c('b-icon-sort-numeric-down') : _c('b-icon-sort-numeric-up')], 1) : _vm._e(), _vm.bulkDelete ? _c('b-button', {
|
|
14287
|
+
attrs: {
|
|
14288
|
+
"variant": "danger"
|
|
14289
|
+
},
|
|
14290
|
+
on: {
|
|
14291
|
+
"click": function click($event) {
|
|
14292
|
+
return _vm.confirmBulkDelete();
|
|
14293
|
+
}
|
|
14294
|
+
}
|
|
14295
|
+
}, [_c('b-icon-trash')], 1) : _vm._e(), _vm.showCreateBtn ? _c('b-button', {
|
|
14190
14296
|
attrs: {
|
|
14191
14297
|
"variant": "success",
|
|
14192
14298
|
"disabled": _vm.loading
|
|
@@ -14897,7 +15003,7 @@ var _sfc_render = function render() {
|
|
|
14897
15003
|
}) : _vm._e()], 2)], 1);
|
|
14898
15004
|
};
|
|
14899
15005
|
var _sfc_staticRenderFns = [];
|
|
14900
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
15006
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "d24c9f33", null, null);
|
|
14901
15007
|
var component$1 = __component__.exports;// Import vue component
|
|
14902
15008
|
|
|
14903
15009
|
// Default export is installable instance of component.
|