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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-laravel-crud",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/clonixdev/vue-laravel-crud",
6
6
  "main": "dist/vue-laravel-crud.ssr.js",
@@ -852,6 +852,60 @@ export default /*#__PURE__*/ {
852
852
  this.loading = false;
853
853
  });
854
854
  },
855
+
856
+
857
+
858
+ deleteItemBulk(){
859
+ if (this.useVuexORM) {
860
+ return this.deleteItemBulkVuex();
861
+ }
862
+
863
+ if (!this.ajax) {
864
+ return this.deleteItemBulkLocal();
865
+ }
866
+
867
+
868
+ let ids = this.selectedItems.map(it => it.id);
869
+
870
+ this.loading = true;
871
+ axios
872
+ .delete(this.apiUrl + "/" + this.modelName + "/bulk-destroy", {ids: ids} )
873
+ .then((response) => {
874
+ this.items = this.items.filter(it => ids.includes(it.id));
875
+ this.toastSuccess("Elemento/s eliminado.");
876
+ this.$emit("itemDeleted", {});
877
+ this.loading = false;
878
+ })
879
+ .catch((error) => {
880
+ this.toastError(error);
881
+ this.loading = false;
882
+ });
883
+ },
884
+ async deleteItemBulkLocal() {
885
+ let ids = this.selectedItems.map(it => it.id);
886
+ this.items = this.items.filter(it => ids.includes(it.id));
887
+ this.item = null;
888
+ this.toastSuccess("Elemento Eliminado");
889
+ this.$emit("itemDeleted", {});
890
+ this.loading = false;
891
+ },
892
+ async deleteItemBulkVuex() {
893
+ /*
894
+ let result = await this.model.api().delete('/' + id, {
895
+ delete: 1
896
+ });
897
+
898
+ console.debug("delete item vuex", result);
899
+ let responseStatus = result.response.status;
900
+
901
+ if (result.response.data.error) {
902
+ this.toastError(result.response.data.error);
903
+ this.loading = false;
904
+ return;
905
+ }
906
+
907
+ this.toastSuccess("Elemento eliminado.");*/
908
+ },
855
909
  deleteItem(id, index) {
856
910
 
857
911
  if (this.useVuexORM) {