vue-laravel-crud 1.4.13 → 1.4.15

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.
@@ -17017,7 +17017,7 @@ var moment = momentExports;
17017
17017
 
17018
17018
  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}}
17019
17019
 
17020
- var css = "tr td[data-v-cc7b4474]:last-child,\ntr td[data-v-cc7b4474]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-cc7b4474] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-cc7b4474] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-cc7b4474] .crud-title[data-v-cc7b4474] {\n margin: 0; }\n .crud-header[data-v-cc7b4474] .crud-search[data-v-cc7b4474] {\n max-width: 15rem; }\n .crud-header[data-v-cc7b4474] .crud-search[data-v-cc7b4474] .btn[data-v-cc7b4474] {\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-cc7b4474] .crud-search[data-v-cc7b4474] .btn[data-v-cc7b4474].open[data-v-cc7b4474] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-cc7b4474] .table-options[data-v-cc7b4474] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-cc7b4474] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-cc7b4474] {\n table-layout: auto; }\n .table[data-v-cc7b4474] tbody[data-v-cc7b4474] td[data-v-cc7b4474] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-cc7b4474] tbody[data-v-cc7b4474] td[data-v-cc7b4474]::-webkit-scrollbar {\n display: none; } }\n";
17020
+ var css = "tr td[data-v-1f4fa85d]:last-child,\ntr td[data-v-1f4fa85d]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-1f4fa85d] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-1f4fa85d] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-1f4fa85d] .crud-title[data-v-1f4fa85d] {\n margin: 0; }\n .crud-header[data-v-1f4fa85d] .crud-search[data-v-1f4fa85d] {\n max-width: 15rem; }\n .crud-header[data-v-1f4fa85d] .crud-search[data-v-1f4fa85d] .btn[data-v-1f4fa85d] {\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-1f4fa85d] .crud-search[data-v-1f4fa85d] .btn[data-v-1f4fa85d].open[data-v-1f4fa85d] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-1f4fa85d] .table-options[data-v-1f4fa85d] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-1f4fa85d] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-1f4fa85d] {\n table-layout: auto; }\n .table[data-v-1f4fa85d] tbody[data-v-1f4fa85d] td[data-v-1f4fa85d] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-1f4fa85d] tbody[data-v-1f4fa85d] td[data-v-1f4fa85d]::-webkit-scrollbar {\n display: none; } }\n";
17021
17021
  n(css, {});
17022
17022
 
17023
17023
  function normalizeComponent (
@@ -17372,7 +17372,10 @@ const _sfc_main = {
17372
17372
  }
17373
17373
  },
17374
17374
  mounted() {
17375
- if (this.useVuexORM) ; else {
17375
+ if (this.useVuexORM) {
17376
+ //this.useVuexORM = true;
17377
+ this.item = new this.model();
17378
+ } else {
17376
17379
  this.item = this.model;
17377
17380
  this.itemDefault = JSON.parse(JSON.stringify(this.item));
17378
17381
  }
@@ -17408,10 +17411,6 @@ const _sfc_main = {
17408
17411
  paginationIndexEnd() {
17409
17412
  return this.paginationIndexStart + this.pagination.per_page;
17410
17413
  },
17411
- /* filteredItems() {
17412
- return this.items;
17413
- },*/
17414
-
17415
17414
  finalFilters() {
17416
17415
  return [...this.filters, ...this.filter, ...this.internalFilter];
17417
17416
  },
@@ -17612,8 +17611,8 @@ const _sfc_main = {
17612
17611
  filters: JSON.stringify(this.finalFilters)
17613
17612
  }
17614
17613
  });
17615
- this.collection = result.entities[this.model.entity];
17616
- console.debug("fetch page vuex ", page, this.collection);
17614
+ this.items = result.entities[this.model.entity];
17615
+ console.debug("fetch page vuex ", page, this.items);
17617
17616
  this.loading = false;
17618
17617
  },
17619
17618
  fetchItems() {
@@ -17673,7 +17672,7 @@ const _sfc_main = {
17673
17672
  this.loading = false;
17674
17673
  });
17675
17674
  },
17676
- removeItem: function (id, index) {
17675
+ removeItem(id, index) {
17677
17676
  this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
17678
17677
  size: "sm",
17679
17678
  buttonSize: "sm",
@@ -17683,21 +17682,39 @@ const _sfc_main = {
17683
17682
  centered: true
17684
17683
  }).then(value => {
17685
17684
  if (value) {
17686
- this.loading = true;
17687
- axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(response => {
17688
- this.items.splice(index, 1);
17689
- this.toastSuccess("Elemento eliminado.");
17690
- this.loading = false;
17691
- }).catch(error => {
17692
- this.toastError(error);
17693
- this.loading = false;
17694
- });
17685
+ this.deleteItem(id, index);
17695
17686
  }
17696
17687
  }).catch(error => {
17697
17688
  this.toastError(error);
17698
17689
  this.loading = false;
17699
17690
  });
17700
17691
  },
17692
+ deleteItem(id, index) {
17693
+ if (this.useVuexORM) {
17694
+ return this.deleteItemVuex(id, index);
17695
+ }
17696
+ this.loading = true;
17697
+ axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(response => {
17698
+ this.items.splice(index, 1);
17699
+ this.toastSuccess("Elemento eliminado.");
17700
+ this.loading = false;
17701
+ }).catch(error => {
17702
+ this.toastError(error);
17703
+ this.loading = false;
17704
+ });
17705
+ },
17706
+ async deleteItemVuex(id, index) {
17707
+ let result = await this.model.api().delete('/' + id, {
17708
+ delete: 1
17709
+ });
17710
+ console.debug("delete item vuex", result);
17711
+ result.response.status;
17712
+ if (result.response.data.error) {
17713
+ this.toastError(result.response.data.error);
17714
+ return;
17715
+ }
17716
+ this.toastSuccess("Elemento eliminado.");
17717
+ },
17701
17718
  saveSort() {
17702
17719
  if (this.orderable) {
17703
17720
  this.loading = true;
@@ -17751,6 +17768,26 @@ const _sfc_main = {
17751
17768
  });
17752
17769
  return ops.join(", ");
17753
17770
  },
17771
+ async saveItemVuex() {
17772
+ let jsondata = this.item.$toJson();
17773
+ console.debug("save item ", this.item, jsondata);
17774
+ let result;
17775
+ if (this.item.id) {
17776
+ result = await this.model.api().put('/' + this.item.id, jsondata);
17777
+ } else {
17778
+ result = await this.model.api().post('', jsondata);
17779
+ }
17780
+ result.response.status;
17781
+ if (result.response.data.error) {
17782
+ this.toastError(result.response.data.error);
17783
+ return;
17784
+ //throw new Error('Something is wrong.')
17785
+ }
17786
+
17787
+ result.save();
17788
+ if (this.refreshAfterSave) this.refresh();
17789
+ this.toastSuccess("Elemento Modificado");
17790
+ },
17754
17791
  async saveItem() {
17755
17792
  let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
17756
17793
  this.loading = true;
@@ -17759,6 +17796,9 @@ const _sfc_main = {
17759
17796
  } else {
17760
17797
  if (event) event.preventDefault();
17761
17798
  }
17799
+ if (this.useVuexORM) {
17800
+ return this.saveItemVuex();
17801
+ }
17762
17802
  if (this.item.id) {
17763
17803
  axios.put(this.apiUrl + "/" + this.modelName + "/" + this.item.id, this.item).then(response => {
17764
17804
  if (this.hideModalAfterSave) {
@@ -17976,7 +18016,7 @@ var _sfc_render = function render() {
17976
18016
  callback: function ($$v) {
17977
18017
  _vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
17978
18018
  },
17979
- expression: "\n internalFilterByProp(column.prop + '_from').value\n "
18019
+ expression: "\n internalFilterByProp(column.prop + '_from').value\n "
17980
18020
  }
17981
18021
  })], 1), _c('div', {
17982
18022
  staticClass: "col-6"
@@ -17992,7 +18032,7 @@ var _sfc_render = function render() {
17992
18032
  callback: function ($$v) {
17993
18033
  _vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
17994
18034
  },
17995
- expression: "\n internalFilterByProp(column.prop + '_to').value\n "
18035
+ expression: "\n internalFilterByProp(column.prop + '_to').value\n "
17996
18036
  }
17997
18037
  })], 1)])]) : column.type == 'state' ? _c('div', {
17998
18038
  staticClass: "form-group"
@@ -18264,7 +18304,7 @@ var _sfc_render = function render() {
18264
18304
  callback: function ($$v) {
18265
18305
  _vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
18266
18306
  },
18267
- expression: "\n internalFilterByProp(column.prop + '_from').value\n "
18307
+ expression: "\n internalFilterByProp(column.prop + '_from').value\n "
18268
18308
  }
18269
18309
  })], 1), _c('div', {
18270
18310
  staticClass: "col-6"
@@ -18280,7 +18320,7 @@ var _sfc_render = function render() {
18280
18320
  callback: function ($$v) {
18281
18321
  _vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
18282
18322
  },
18283
- expression: "\n internalFilterByProp(column.prop + '_to').value\n "
18323
+ expression: "\n internalFilterByProp(column.prop + '_to').value\n "
18284
18324
  }
18285
18325
  })], 1)]) : column.type == 'state' ? _c('select', {
18286
18326
  directives: [{
@@ -18410,13 +18450,13 @@ var _sfc_render = function render() {
18410
18450
  }
18411
18451
  },
18412
18452
  model: {
18413
- value: _vm.items,
18453
+ value: _vm.itemsList,
18414
18454
  callback: function ($$v) {
18415
- _vm.items = $$v;
18455
+ _vm.itemsList = $$v;
18416
18456
  },
18417
- expression: "items"
18457
+ expression: "itemsList"
18418
18458
  }
18419
- }, _vm._l(_vm.items, function (item, index) {
18459
+ }, _vm._l(_vm.itemsList, function (item, index) {
18420
18460
  return _c('tr', {
18421
18461
  key: index,
18422
18462
  staticClass: "item",
@@ -18507,9 +18547,9 @@ var _sfc_render = function render() {
18507
18547
  }, {
18508
18548
  "item": item
18509
18549
  })]], 2);
18510
- }), 0)], 1), _vm.items.length == 0 ? _c('p', {
18550
+ }), 0)], 1), _vm.itemsList.length == 0 ? _c('p', {
18511
18551
  staticClass: "p-3"
18512
- }, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()]) : _vm._e(), _vm.displayMode == _vm.displayModes.MODE_CARDS ? _c('div', [_vm.items.length == 0 ? _c('p', {
18552
+ }, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()]) : _vm._e(), _vm.displayMode == _vm.displayModes.MODE_CARDS ? _c('div', [_vm.itemsList.length == 0 ? _c('p', {
18513
18553
  staticClass: "p-3"
18514
18554
  }, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e(), _c('draggable', {
18515
18555
  staticClass: "row",
@@ -18529,13 +18569,13 @@ var _sfc_render = function render() {
18529
18569
  }
18530
18570
  },
18531
18571
  model: {
18532
- value: _vm.items,
18572
+ value: _vm.itemsList,
18533
18573
  callback: function ($$v) {
18534
- _vm.items = $$v;
18574
+ _vm.itemsList = $$v;
18535
18575
  },
18536
- expression: "items"
18576
+ expression: "itemsList"
18537
18577
  }
18538
- }, _vm._l(_vm.items, function (item, index) {
18578
+ }, _vm._l(_vm.itemsList, function (item, index) {
18539
18579
  return _c('b-col', {
18540
18580
  key: index,
18541
18581
  staticClass: "item",
@@ -18622,9 +18662,9 @@ var _sfc_render = function render() {
18622
18662
  })], 2)], 1);
18623
18663
  }), 1)], 1) : _vm._e(), _vm.displayMode == _vm.displayModes.MODE_CUSTOM ? _c('div', [_c('div', {
18624
18664
  class: _vm.listContainerClass
18625
- }, [_vm.items.length == 0 ? _c('p', {
18665
+ }, [_vm.itemsList.length == 0 ? _c('p', {
18626
18666
  staticClass: "p-3"
18627
- }, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e(), _vm._l(_vm.items, function (item, index) {
18667
+ }, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e(), _vm._l(_vm.itemsList, function (item, index) {
18628
18668
  return _c('div', {
18629
18669
  key: index,
18630
18670
  class: _vm.listItemClass
@@ -18755,7 +18795,7 @@ var _sfc_render = function render() {
18755
18795
  })], 2)], 1);
18756
18796
  };
18757
18797
  var _sfc_staticRenderFns = [];
18758
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "cc7b4474", null, null);
18798
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "1f4fa85d", null, null);
18759
18799
  var component = __component__.exports;
18760
18800
 
18761
18801
  // Import vue component