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