vue-laravel-crud 1.6.21 → 1.6.23
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 +157 -8
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +265 -111
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +315 -184
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -24,7 +24,7 @@ export default /*#__PURE__*/ {
|
|
|
24
24
|
items: [],
|
|
25
25
|
selectedItems: [],
|
|
26
26
|
pagination: {
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
current_page: 1,
|
|
29
29
|
last_page: 1,
|
|
30
30
|
next_page_url: "",
|
|
@@ -267,6 +267,14 @@ export default /*#__PURE__*/ {
|
|
|
267
267
|
type: String,
|
|
268
268
|
default: "Nuevo",
|
|
269
269
|
},
|
|
270
|
+
messageImport: {
|
|
271
|
+
type: String,
|
|
272
|
+
default: "Importar",
|
|
273
|
+
},
|
|
274
|
+
messageExport: {
|
|
275
|
+
type: String,
|
|
276
|
+
default: "Exportar",
|
|
277
|
+
},
|
|
270
278
|
messageEmptyResults: {
|
|
271
279
|
type: String,
|
|
272
280
|
default: "No se han encontrado resultados",
|
|
@@ -353,6 +361,16 @@ export default /*#__PURE__*/ {
|
|
|
353
361
|
default: false,
|
|
354
362
|
},
|
|
355
363
|
|
|
364
|
+
showImport: {
|
|
365
|
+
type: Boolean,
|
|
366
|
+
default: false,
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
showExport: {
|
|
370
|
+
type: Boolean,
|
|
371
|
+
default: false,
|
|
372
|
+
}
|
|
373
|
+
|
|
356
374
|
},
|
|
357
375
|
|
|
358
376
|
mounted() {
|
|
@@ -421,7 +439,7 @@ export default /*#__PURE__*/ {
|
|
|
421
439
|
} else {
|
|
422
440
|
|
|
423
441
|
if (this.grouped) {
|
|
424
|
-
|
|
442
|
+
this.groupItems(this.models);
|
|
425
443
|
} else {
|
|
426
444
|
this.items = this.models;
|
|
427
445
|
}
|
|
@@ -470,14 +488,14 @@ export default /*#__PURE__*/ {
|
|
|
470
488
|
...this.sortFilter
|
|
471
489
|
];
|
|
472
490
|
},
|
|
473
|
-
sortFilter(){
|
|
474
|
-
if(this.showPrincipalSortBtn){
|
|
475
|
-
if(this.principalSort){
|
|
476
|
-
return [[this.principalSortColumn,'SORTASC','']];
|
|
477
|
-
}else{
|
|
478
|
-
return [[this.principalSortColumn,'SORTDESC','']];
|
|
491
|
+
sortFilter() {
|
|
492
|
+
if (this.showPrincipalSortBtn) {
|
|
493
|
+
if (this.principalSort) {
|
|
494
|
+
return [[this.principalSortColumn, 'SORTASC', '']];
|
|
495
|
+
} else {
|
|
496
|
+
return [[this.principalSortColumn, 'SORTDESC', '']];
|
|
479
497
|
}
|
|
480
|
-
}else{
|
|
498
|
+
} else {
|
|
481
499
|
return [];
|
|
482
500
|
}
|
|
483
501
|
|
|
@@ -487,14 +505,14 @@ export default /*#__PURE__*/ {
|
|
|
487
505
|
this.forceRecomputeCounter;
|
|
488
506
|
this.internalFilters.forEach((f) => {
|
|
489
507
|
|
|
490
|
-
|
|
491
508
|
|
|
492
|
-
if (f.value){
|
|
493
509
|
|
|
494
|
-
|
|
510
|
+
if (f.value) {
|
|
511
|
+
|
|
512
|
+
let colname = f.column.replace("_sort", "").replace("_from", "").replace("_to", "");
|
|
495
513
|
|
|
496
514
|
filter.push([colname, f.op, f.value]);
|
|
497
|
-
}
|
|
515
|
+
}
|
|
498
516
|
});
|
|
499
517
|
return filter;
|
|
500
518
|
},
|
|
@@ -515,15 +533,15 @@ export default /*#__PURE__*/ {
|
|
|
515
533
|
this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
|
|
516
534
|
},
|
|
517
535
|
|
|
518
|
-
togglePrincipalSort(){
|
|
536
|
+
togglePrincipalSort() {
|
|
519
537
|
this.principalSort = !this.principalSort;
|
|
520
538
|
setTimeout(() => {
|
|
521
|
-
|
|
522
|
-
|
|
539
|
+
this.refresh();
|
|
540
|
+
}, 1);
|
|
523
541
|
},
|
|
524
542
|
infiniteHandler($state) {
|
|
525
|
-
|
|
526
|
-
|
|
543
|
+
|
|
544
|
+
|
|
527
545
|
const hasNextPage = (this.pagination.total > 0 || !this.firstLoad) && (!this.firstLoad || (this.pagination.current_page * this.pagination.per_page) <= this.pagination.total);
|
|
528
546
|
console.debug("Has next page", hasNextPage, this.pagination);
|
|
529
547
|
if (hasNextPage) {
|
|
@@ -652,30 +670,30 @@ export default /*#__PURE__*/ {
|
|
|
652
670
|
},
|
|
653
671
|
onCheckSelect(value, item) {
|
|
654
672
|
console.debug("ON CHECK SELECT", value, item);
|
|
655
|
-
if(value){
|
|
673
|
+
if (value) {
|
|
656
674
|
this.item = item;
|
|
657
675
|
this.selectItem();
|
|
658
|
-
}else{
|
|
676
|
+
} else {
|
|
659
677
|
this.unSelectItem(item);
|
|
660
678
|
}
|
|
661
679
|
this.onSelect();
|
|
662
|
-
console.debug("Selected Items",this.selectedItems);
|
|
680
|
+
console.debug("Selected Items", this.selectedItems);
|
|
663
681
|
},
|
|
664
682
|
toggleAll(value) {
|
|
665
683
|
|
|
666
684
|
|
|
667
|
-
if(value){
|
|
685
|
+
if (value) {
|
|
668
686
|
this.selectedItems = this.items;
|
|
669
687
|
|
|
670
688
|
this.selectedItems.forEach(
|
|
671
|
-
(item) =>
|
|
689
|
+
(item) => item.selected = true
|
|
672
690
|
);
|
|
673
|
-
}else{
|
|
691
|
+
} else {
|
|
674
692
|
this.selectedItems.forEach(
|
|
675
|
-
(item) =>
|
|
693
|
+
(item) => item.selected = false
|
|
676
694
|
);
|
|
677
695
|
this.items.forEach(
|
|
678
|
-
(item) =>
|
|
696
|
+
(item) => item.selected = false
|
|
679
697
|
);
|
|
680
698
|
this.selectedItems = [];
|
|
681
699
|
|
|
@@ -683,16 +701,16 @@ export default /*#__PURE__*/ {
|
|
|
683
701
|
|
|
684
702
|
this.onSelect();
|
|
685
703
|
|
|
686
|
-
console.debug("toggle all",this.selectedItems);
|
|
704
|
+
console.debug("toggle all", this.selectedItems);
|
|
687
705
|
this.$forceUpdate();
|
|
688
706
|
},
|
|
689
|
-
unSelectItem(item){
|
|
707
|
+
unSelectItem(item) {
|
|
690
708
|
|
|
691
709
|
item.selected = false;
|
|
692
710
|
|
|
693
711
|
this.selectedItems = this.selectedItems.filter(
|
|
694
|
-
|
|
695
|
-
|
|
712
|
+
(e) => e.id != item.id
|
|
713
|
+
);
|
|
696
714
|
|
|
697
715
|
},
|
|
698
716
|
selectItem() {
|
|
@@ -838,7 +856,7 @@ export default /*#__PURE__*/ {
|
|
|
838
856
|
this.makePagination(response.data);
|
|
839
857
|
let items = response.data.data;
|
|
840
858
|
if (this.grouped) {
|
|
841
|
-
this.groupItems(items,concat);
|
|
859
|
+
this.groupItems(items, concat);
|
|
842
860
|
} else {
|
|
843
861
|
if (concat) {
|
|
844
862
|
this.items = this.items.concat(items);
|
|
@@ -860,38 +878,38 @@ export default /*#__PURE__*/ {
|
|
|
860
878
|
});
|
|
861
879
|
},
|
|
862
880
|
|
|
863
|
-
groupItems(items,concat = false){
|
|
881
|
+
groupItems(items, concat = false) {
|
|
864
882
|
let itemswithgroup = [];
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
itemswithgroup.push(item);
|
|
888
|
-
}
|
|
883
|
+
let lastcomparevalue = null;
|
|
884
|
+
let compareattr = this.groupedAttribute;
|
|
885
|
+
let groupLabelPre = this.groupedLabelPre;
|
|
886
|
+
let groupLabelAfter = this.groupedLabelAfter;
|
|
887
|
+
items.forEach((item, key) => {
|
|
888
|
+
if (Array.isArray(item)) {
|
|
889
|
+
itemswithgroup.push({
|
|
890
|
+
label: groupLabelPre + key + groupLabelAfter,
|
|
891
|
+
group: true,
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
item.forEach((sitem) => {
|
|
895
|
+
itemswithgroup.push(sitem);
|
|
896
|
+
});
|
|
897
|
+
} else {
|
|
898
|
+
if (lastcomparevalue != item[compareattr]) {
|
|
899
|
+
lastcomparevalue = item[compareattr];
|
|
900
|
+
itemswithgroup.push({
|
|
901
|
+
crudgrouplabel: groupLabelPre + lastcomparevalue + groupLabelAfter,
|
|
902
|
+
crudgroup: true,
|
|
889
903
|
});
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
904
|
+
}
|
|
905
|
+
itemswithgroup.push(item);
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
if (concat) {
|
|
909
|
+
this.items = this.items.concat(itemswithgroup);
|
|
910
|
+
} else {
|
|
911
|
+
this.items = itemswithgroup;
|
|
912
|
+
}
|
|
895
913
|
},
|
|
896
914
|
removeItem(id, index) {
|
|
897
915
|
this.$bvModal
|
|
@@ -914,7 +932,7 @@ export default /*#__PURE__*/ {
|
|
|
914
932
|
});
|
|
915
933
|
},
|
|
916
934
|
|
|
917
|
-
confirmBulkDelete(){
|
|
935
|
+
confirmBulkDelete() {
|
|
918
936
|
this.$bvModal
|
|
919
937
|
.msgBoxConfirm(this.messageRemoveBulkConfirm, {
|
|
920
938
|
size: "sm",
|
|
@@ -934,7 +952,7 @@ export default /*#__PURE__*/ {
|
|
|
934
952
|
this.loading = false;
|
|
935
953
|
});
|
|
936
954
|
},
|
|
937
|
-
deleteItemBulk(){
|
|
955
|
+
deleteItemBulk() {
|
|
938
956
|
if (this.useVuexORM) {
|
|
939
957
|
return this.deleteItemBulkVuex();
|
|
940
958
|
}
|
|
@@ -948,7 +966,7 @@ export default /*#__PURE__*/ {
|
|
|
948
966
|
|
|
949
967
|
this.loading = true;
|
|
950
968
|
axios
|
|
951
|
-
.delete(this.apiUrl + "/" + this.modelName + "/bulk-destroy", {
|
|
969
|
+
.delete(this.apiUrl + "/" + this.modelName + "/bulk-destroy", { params: { ids: ids }, })
|
|
952
970
|
.then((response) => {
|
|
953
971
|
this.items = this.items.filter(it => !ids.includes(it.id));
|
|
954
972
|
this.toastSuccess("Elemento/s eliminado.");
|
|
@@ -969,21 +987,21 @@ export default /*#__PURE__*/ {
|
|
|
969
987
|
this.loading = false;
|
|
970
988
|
},
|
|
971
989
|
async deleteItemBulkVuex() {
|
|
972
|
-
/*
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
990
|
+
/*
|
|
991
|
+
let result = await this.model.api().delete('/' + id, {
|
|
992
|
+
delete: 1
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
console.debug("delete item vuex", result);
|
|
996
|
+
let responseStatus = result.response.status;
|
|
997
|
+
|
|
998
|
+
if (result.response.data.error) {
|
|
999
|
+
this.toastError(result.response.data.error);
|
|
1000
|
+
this.loading = false;
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
this.toastSuccess("Elemento eliminado.");*/
|
|
987
1005
|
},
|
|
988
1006
|
deleteItem(id, index) {
|
|
989
1007
|
|
|
@@ -1010,6 +1028,7 @@ export default /*#__PURE__*/ {
|
|
|
1010
1028
|
});
|
|
1011
1029
|
},
|
|
1012
1030
|
|
|
1031
|
+
|
|
1013
1032
|
async deleteItemLocal(id, index) {
|
|
1014
1033
|
if (id || index) {
|
|
1015
1034
|
let itemIndex;
|
|
@@ -1079,6 +1098,67 @@ export default /*#__PURE__*/ {
|
|
|
1079
1098
|
});
|
|
1080
1099
|
}
|
|
1081
1100
|
},
|
|
1101
|
+
exportItems() {
|
|
1102
|
+
if (this.useVuexORM) {
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
if (!this.ajax) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
let exportItems = true;
|
|
1111
|
+
let params;
|
|
1112
|
+
|
|
1113
|
+
let ids = this.selectedItems.map(it => it.id);
|
|
1114
|
+
|
|
1115
|
+
if (ids.length) {
|
|
1116
|
+
params = { ids: ids, exportItems: exportItems, };
|
|
1117
|
+
} else {
|
|
1118
|
+
params = { filters: JSON.stringify(this.finalFilters), exportItems: exportItems, };
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
this.loading = true;
|
|
1124
|
+
axios
|
|
1125
|
+
.delete(this.apiUrl + "/" + this.modelName + "/export", { params: params, })
|
|
1126
|
+
.then((response) => {
|
|
1127
|
+
this.downloadBlobResponse(response, extension);
|
|
1128
|
+
this.loading = false;
|
|
1129
|
+
})
|
|
1130
|
+
.catch((error) => {
|
|
1131
|
+
this.toastError(error);
|
|
1132
|
+
this.loading = false;
|
|
1133
|
+
});
|
|
1134
|
+
},
|
|
1135
|
+
|
|
1136
|
+
importItems() {
|
|
1137
|
+
let formData = new FormData();
|
|
1138
|
+
formData.append("file", this.fileImport);
|
|
1139
|
+
axios
|
|
1140
|
+
.post(this.apiUrl + "/" + this.modelName + "/impport", formData, {
|
|
1141
|
+
headers: {
|
|
1142
|
+
"Content-Type": "multipart/form-data",
|
|
1143
|
+
},
|
|
1144
|
+
})
|
|
1145
|
+
.then((response) => {
|
|
1146
|
+
if (response && response.data && response.data.success == true) {
|
|
1147
|
+
this.$refs["modal-import"].hide();
|
|
1148
|
+
this.toastSuccess("Datos Importados con Éxito");
|
|
1149
|
+
this.$refs["crud"].refresh();
|
|
1150
|
+
} else {
|
|
1151
|
+
this.toastError("No se pudo importar los datos.");
|
|
1152
|
+
}
|
|
1153
|
+
})
|
|
1154
|
+
.catch((error) => {
|
|
1155
|
+
console.error(error);
|
|
1156
|
+
this.toastError(error);
|
|
1157
|
+
|
|
1158
|
+
});
|
|
1159
|
+
},
|
|
1160
|
+
|
|
1161
|
+
|
|
1082
1162
|
getArrayValue(value, displayProp, options = []) {
|
|
1083
1163
|
if (!Array.isArray(value)) return "N/A";
|
|
1084
1164
|
let values = [];
|
|
@@ -1384,7 +1464,30 @@ export default /*#__PURE__*/ {
|
|
|
1384
1464
|
appendToast: true,
|
|
1385
1465
|
});
|
|
1386
1466
|
},
|
|
1467
|
+
downloadBlobResponse(response,extension = null) {
|
|
1468
|
+
const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
1469
|
+
const link = document.createElement("a");
|
|
1470
|
+
link.href = url;
|
|
1471
|
+
|
|
1472
|
+
let contentdisposition = response.headers['content-disposition'];
|
|
1473
|
+
let filename = "Export";
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
if (contentdisposition) {
|
|
1477
|
+
filename = contentdisposition.split('filename=')[1].split('.')[0];
|
|
1478
|
+
filename = filename.replace('_', '');
|
|
1479
|
+
filename = filename.replace('"', '');
|
|
1480
|
+
extension = contentdisposition.split('.')[1].split(';')[0];
|
|
1481
|
+
extension = extension.replace('_', '');
|
|
1482
|
+
extension = extension.replace('"', '');
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1387
1485
|
|
|
1486
|
+
console.debug("DOWNLOAD ",filename,extension);
|
|
1487
|
+
link.setAttribute("download", filename + '.' + extension);
|
|
1488
|
+
document.body.appendChild(link);
|
|
1489
|
+
link.click();
|
|
1490
|
+
},
|
|
1388
1491
|
onChangeFilter(event) {
|
|
1389
1492
|
this.forceRecomputeCounter++;
|
|
1390
1493
|
console.debug("Filters debug ", this.finalFilters, this.internalFilter, this.internalFilters, this.filter, this.filters);
|
|
@@ -1460,10 +1563,10 @@ export default /*#__PURE__*/ {
|
|
|
1460
1563
|
:key="option.id ? option.id : option.value">
|
|
1461
1564
|
{{
|
|
1462
1565
|
option.text
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1566
|
+
? option.text
|
|
1567
|
+
: option.label
|
|
1568
|
+
? option.label
|
|
1569
|
+
: ""
|
|
1467
1570
|
}}
|
|
1468
1571
|
</option>
|
|
1469
1572
|
</select>
|
|
@@ -1480,10 +1583,10 @@ export default /*#__PURE__*/ {
|
|
|
1480
1583
|
:key="option.id ? option.id : option.value">
|
|
1481
1584
|
{{
|
|
1482
1585
|
option.text
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1586
|
+
? option.text
|
|
1587
|
+
: option.label
|
|
1588
|
+
? option.label
|
|
1589
|
+
: ""
|
|
1487
1590
|
}}
|
|
1488
1591
|
</option>
|
|
1489
1592
|
</template>
|
|
@@ -1519,11 +1622,18 @@ export default /*#__PURE__*/ {
|
|
|
1519
1622
|
v-bind:loading="loading">
|
|
1520
1623
|
<slot name="tableActionsPrepend" v-bind:loading="loading"> </slot>
|
|
1521
1624
|
|
|
1625
|
+
<b-button variant="info" v-b-modal.modal-import v-if="showImport">
|
|
1626
|
+
<b-icon-cloud-upload></b-icon-cloud-upload>{{ messageImport }}
|
|
1627
|
+
</b-button>
|
|
1628
|
+
<b-button variant="info" @click="exportItems()" v-if="showExport">
|
|
1629
|
+
<b-icon-cloud-download></b-icon-cloud-download>{{ messageExport }}
|
|
1630
|
+
</b-button>
|
|
1522
1631
|
<b-button variant="info" v-if="showPrincipalSortBtn" @click="togglePrincipalSort()" :disabled="loading">
|
|
1523
1632
|
<b-icon-sort-numeric-down v-if="principalSort"></b-icon-sort-numeric-down>
|
|
1524
1633
|
<b-icon-sort-numeric-up v-else></b-icon-sort-numeric-up>
|
|
1525
1634
|
</b-button>
|
|
1526
|
-
<b-button variant="danger" @click="confirmBulkDelete()"
|
|
1635
|
+
<b-button variant="danger" @click="confirmBulkDelete()"
|
|
1636
|
+
v-if="bulkDelete"><b-icon-trash></b-icon-trash></b-button>
|
|
1527
1637
|
<b-button variant="success" v-if="showCreateBtn" @click="createItem()" :disabled="loading">
|
|
1528
1638
|
<b-icon-plus></b-icon-plus>{{ messageNew }}
|
|
1529
1639
|
</b-button>
|
|
@@ -1563,7 +1673,7 @@ export default /*#__PURE__*/ {
|
|
|
1563
1673
|
filtersVisible &&
|
|
1564
1674
|
isColumnHasFilter(column) &&
|
|
1565
1675
|
internalFilterByProp(column.prop)
|
|
1566
|
-
|
|
1676
|
+
">
|
|
1567
1677
|
|
|
1568
1678
|
<div class="form-group">
|
|
1569
1679
|
<select v-if="column.type == 'boolean'" class="form-control form-control-md p-2"
|
|
@@ -1593,10 +1703,10 @@ export default /*#__PURE__*/ {
|
|
|
1593
1703
|
<option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
|
|
1594
1704
|
{{
|
|
1595
1705
|
option.text
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1706
|
+
? option.text
|
|
1707
|
+
: option.label
|
|
1708
|
+
? option.label
|
|
1709
|
+
: ""
|
|
1600
1710
|
}}
|
|
1601
1711
|
</option>
|
|
1602
1712
|
</select>
|
|
@@ -1608,17 +1718,18 @@ export default /*#__PURE__*/ {
|
|
|
1608
1718
|
<option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
|
|
1609
1719
|
{{
|
|
1610
1720
|
option.text
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1721
|
+
? option.text
|
|
1722
|
+
: option.label
|
|
1723
|
+
? option.label
|
|
1724
|
+
: ""
|
|
1615
1725
|
}}
|
|
1616
1726
|
</option>
|
|
1617
1727
|
</select>
|
|
1618
1728
|
|
|
1619
|
-
<b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all"
|
|
1729
|
+
<b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all"
|
|
1730
|
+
@change="toggleAll($event)">
|
|
1620
1731
|
</b-form-checkbox>
|
|
1621
|
-
|
|
1732
|
+
|
|
1622
1733
|
<b-form-checkbox v-else-if="column.type == 'select'" name="select-all" @change="toggleAll($event)">
|
|
1623
1734
|
</b-form-checkbox>
|
|
1624
1735
|
|
|
@@ -1629,16 +1740,18 @@ export default /*#__PURE__*/ {
|
|
|
1629
1740
|
</div>
|
|
1630
1741
|
</slot>
|
|
1631
1742
|
<span v-else-if="column.type == 'select'">
|
|
1632
|
-
|
|
1743
|
+
<b-form-checkbox name="select-all" @change="toggleAll($event)"></b-form-checkbox>
|
|
1633
1744
|
</span>
|
|
1634
1745
|
<span v-else>{{ column.label }}</span>
|
|
1635
1746
|
|
|
1636
1747
|
|
|
1637
|
-
<span
|
|
1638
|
-
|
|
1748
|
+
<span
|
|
1749
|
+
v-if="sortable && column.type != 'select' && column.type != 'checkbox' && internalFilterByProp(column.prop + '_sort')"
|
|
1750
|
+
class="sort-filter" @click="toggleSortFilter(column)"><b-icon-sort-down
|
|
1639
1751
|
v-if="!internalFilterByProp(column.prop + '_sort').value"></b-icon-sort-down><b-icon-sort-up
|
|
1640
1752
|
v-if="internalFilterByProp(column.prop + '_sort').value == 'ASC'"></b-icon-sort-up>
|
|
1641
|
-
<b-icon-sort-down
|
|
1753
|
+
<b-icon-sort-down
|
|
1754
|
+
v-if="internalFilterByProp(column.prop + '_sort').value == 'DESC'"></b-icon-sort-down>
|
|
1642
1755
|
</span>
|
|
1643
1756
|
</th>
|
|
1644
1757
|
</slot>
|
|
@@ -1664,19 +1777,19 @@ export default /*#__PURE__*/ {
|
|
|
1664
1777
|
<b-badge variant="success" v-if="itemValue(column, item) == 'true' ||
|
|
1665
1778
|
itemValue(column, item) == 1 ||
|
|
1666
1779
|
itemValue(column, item) == '1'
|
|
1667
|
-
|
|
1780
|
+
"><b-icon-check-circle></b-icon-check-circle></b-badge>
|
|
1668
1781
|
<b-badge variant="danger" v-if="!itemValue(column, item) ||
|
|
1669
1782
|
itemValue(column, item) == '0' ||
|
|
1670
1783
|
itemValue(column, item) == 'false'
|
|
1671
|
-
|
|
1784
|
+
"><b-icon-x-circle></b-icon-x-circle></b-badge>
|
|
1672
1785
|
</span>
|
|
1673
1786
|
<span v-else-if="column.type == 'date'">
|
|
1674
1787
|
{{
|
|
1675
1788
|
itemValue(column, item)
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1789
|
+
? moment(itemValue(column, item)).format(
|
|
1790
|
+
column.format ? column.format : 'L LT'
|
|
1791
|
+
)
|
|
1792
|
+
: itemValue(column, item)
|
|
1680
1793
|
}}
|
|
1681
1794
|
</span>
|
|
1682
1795
|
<span v-else-if="column.type == 'select'">
|
|
@@ -1730,76 +1843,75 @@ export default /*#__PURE__*/ {
|
|
|
1730
1843
|
</div>
|
|
1731
1844
|
|
|
1732
1845
|
<div v-if="displayMode == displayModes.MODE_CARDS">
|
|
1733
|
-
<draggable v-model="items" :group="draggableGroup" :draggable="orderable ? '.item' : '.none'"
|
|
1734
|
-
@
|
|
1735
|
-
|
|
1846
|
+
<draggable v-model="items" :group="draggableGroup" :draggable="orderable ? '.item' : '.none'" @start="drag = true"
|
|
1847
|
+
@end="drag = false" @sort="onSort()" @add="onDraggableAdded($event)" @change="onDraggableChange($event)"
|
|
1848
|
+
:options="draggableOptions">
|
|
1736
1849
|
<masonry
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
itemValue(column, item) == '1'
|
|
1850
|
+
:cols="{ default: 12 / colLg, 1400: 12 / colXl, 1200: 12 / colLg, 1000: 12 / colMd, 700: 12 / colSm, 400: 12 / colXs }"
|
|
1851
|
+
:gutter="{ default: '15px', 700: '15px' }">
|
|
1852
|
+
|
|
1853
|
+
<div v-for="(item, index) in itemsList" v-bind:key="index" class="item">
|
|
1854
|
+
<b-card :title="item.title" tag="article" class="mb-2 card-crud" :class="cardClass"
|
|
1855
|
+
:hideFooter="cardHideFooter">
|
|
1856
|
+
<slot name="card" v-bind:item="item">
|
|
1857
|
+
<div v-for="(column, indexc) in columns" :key="indexc">
|
|
1858
|
+
<b-card-text v-if="column.type != 'actions'">{{ column.label }}:
|
|
1859
|
+
<slot :name="'cell-' + column.prop" v-bind:item="item" v-bind:index="index" v-bind:itemindex="index"
|
|
1860
|
+
v-bind:columnindex="indexc">
|
|
1861
|
+
<span v-if="column.type == 'boolean'">
|
|
1862
|
+
<b-badge variant="success" v-if="itemValue(column, item) == 'true' ||
|
|
1863
|
+
itemValue(column, item) == 1 ||
|
|
1864
|
+
itemValue(column, item) == '1'
|
|
1753
1865
|
"><b-icon-check-circle></b-icon-check-circle></b-badge>
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1866
|
+
<b-badge variant="danger" v-if="!itemValue(column, item) ||
|
|
1867
|
+
itemValue(column, item) == '0' ||
|
|
1868
|
+
itemValue(column, item) == 'false'
|
|
1757
1869
|
"><b-icon-x-circle></b-icon-x-circle></b-badge>
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1870
|
+
</span>
|
|
1871
|
+
<span v-else-if="column.type == 'date'">
|
|
1872
|
+
{{ itemValue(column, item) }}
|
|
1873
|
+
</span>
|
|
1874
|
+
<span v-else-if="column.type == 'state'">
|
|
1875
|
+
{{
|
|
1876
|
+
getStateValue(itemValue(column, item), column.options)
|
|
1877
|
+
}}
|
|
1878
|
+
</span>
|
|
1879
|
+
<span v-else-if="column.type == 'array'">
|
|
1880
|
+
{{
|
|
1881
|
+
getArrayValue(
|
|
1882
|
+
itemValue(column, item),
|
|
1883
|
+
column.displayProp,
|
|
1884
|
+
column.options
|
|
1885
|
+
)
|
|
1886
|
+
}}
|
|
1887
|
+
</span>
|
|
1888
|
+
<span v-else>
|
|
1889
|
+
{{ itemValue(column, item) }}
|
|
1890
|
+
</span>
|
|
1891
|
+
</slot>
|
|
1892
|
+
</b-card-text>
|
|
1893
|
+
</div>
|
|
1894
|
+
</slot>
|
|
1895
|
+
|
|
1896
|
+
<template v-slot:footer>
|
|
1897
|
+
<b-button-group>
|
|
1898
|
+
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
1899
|
+
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
1900
|
+
<b-button variant="primary" @click="showItem(item.id, index)">
|
|
1901
|
+
<b-icon-eye></b-icon-eye>
|
|
1902
|
+
</b-button>
|
|
1903
|
+
<b-button variant="secondary" @click="updateItem(item.id, index)">
|
|
1904
|
+
<b-icon-pencil></b-icon-pencil>
|
|
1905
|
+
</b-button>
|
|
1906
|
+
<b-button variant="danger" @click="removeItem(item.id, index)">
|
|
1907
|
+
<b-icon-trash></b-icon-trash>
|
|
1908
|
+
</b-button>
|
|
1779
1909
|
</slot>
|
|
1780
|
-
</b-
|
|
1781
|
-
</
|
|
1782
|
-
</
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
<b-button-group>
|
|
1786
|
-
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
1787
|
-
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
1788
|
-
<b-button variant="primary" @click="showItem(item.id, index)">
|
|
1789
|
-
<b-icon-eye></b-icon-eye>
|
|
1790
|
-
</b-button>
|
|
1791
|
-
<b-button variant="secondary" @click="updateItem(item.id, index)">
|
|
1792
|
-
<b-icon-pencil></b-icon-pencil>
|
|
1793
|
-
</b-button>
|
|
1794
|
-
<b-button variant="danger" @click="removeItem(item.id, index)">
|
|
1795
|
-
<b-icon-trash></b-icon-trash>
|
|
1796
|
-
</b-button>
|
|
1797
|
-
</slot>
|
|
1798
|
-
</b-button-group>
|
|
1799
|
-
</template>
|
|
1800
|
-
</b-card>
|
|
1801
|
-
</div>
|
|
1802
|
-
</masonry>
|
|
1910
|
+
</b-button-group>
|
|
1911
|
+
</template>
|
|
1912
|
+
</b-card>
|
|
1913
|
+
</div>
|
|
1914
|
+
</masonry>
|
|
1803
1915
|
</draggable>
|
|
1804
1916
|
|
|
1805
1917
|
<p v-if="!loading && items && items.length == 0 && !infiniteScroll" class="p-3">
|
|
@@ -1819,7 +1931,7 @@ export default /*#__PURE__*/ {
|
|
|
1819
1931
|
</div>
|
|
1820
1932
|
</div>
|
|
1821
1933
|
<b-overlay :show="loading" rounded="sm"></b-overlay>
|
|
1822
|
-
<infinite-loading ref="infiniteLoading" @infinite="infiniteHandler" v-if="infiniteScroll
|
|
1934
|
+
<infinite-loading ref="infiniteLoading" @infinite="infiniteHandler" v-if="infiniteScroll"
|
|
1823
1935
|
:forceUseInfiniteWrapper="true" :key="infiniteScrollKey">
|
|
1824
1936
|
<div slot="spinner">
|
|
1825
1937
|
<div class="text-center">{{ messageLoading }}</div>
|
|
@@ -1831,8 +1943,10 @@ export default /*#__PURE__*/ {
|
|
|
1831
1943
|
<div class="text-center" v-if="!loading">{{ items.length == 0 ? messageEmptyResults : messageNoMore }}</div>
|
|
1832
1944
|
</div>
|
|
1833
1945
|
</infinite-loading>
|
|
1834
|
-
<div class="paginator-data"
|
|
1835
|
-
Filas: {{ pagination.total }} |xPág: {{ pagination.per_page }} |Pág: {{ pagination.current_page }} |Seleccionados:
|
|
1946
|
+
<div class="paginator-data" v-if="!infiniteScroll">
|
|
1947
|
+
Filas: {{ pagination.total }} |xPág: {{ pagination.per_page }} |Pág: {{ pagination.current_page }} |Seleccionados:
|
|
1948
|
+
{{
|
|
1949
|
+
selectedItems.length }}
|
|
1836
1950
|
</div>
|
|
1837
1951
|
<div class="crud-paginator" v-if="!infiniteScroll">
|
|
1838
1952
|
<b-pagination v-if="showPaginator" v-model="pagination.current_page" :total-rows="pagination.total"
|
|
@@ -1854,7 +1968,7 @@ export default /*#__PURE__*/ {
|
|
|
1854
1968
|
</template>
|
|
1855
1969
|
<template v-if="!validate">
|
|
1856
1970
|
<slot name="form" v-bind:item="item" v-if="item">
|
|
1857
|
-
<b-form-group :label="key" v-for="(value, key) in
|
|
1971
|
+
<b-form-group :label="key" v-for="(value, key) in item" :key="key">
|
|
1858
1972
|
<b-form-input v-model="item[key]" type="text" required></b-form-input>
|
|
1859
1973
|
</b-form-group>
|
|
1860
1974
|
</slot>
|
|
@@ -1867,7 +1981,7 @@ export default /*#__PURE__*/ {
|
|
|
1867
1981
|
<b-modal :id="'modal-show-item-' + modelName" hide-footer size="xl" :title="title" no-close-on-backdrop>
|
|
1868
1982
|
<slot name="show" v-bind:item="item" v-if="item">
|
|
1869
1983
|
<b-list-group>
|
|
1870
|
-
<b-list-group-item v-for="(value, key) in
|
|
1984
|
+
<b-list-group-item v-for="(value, key) in item" :key="key">
|
|
1871
1985
|
<b-row class="w-100">
|
|
1872
1986
|
<b-col cols="4" class="font-weight-bold">{{ key }}</b-col>
|
|
1873
1987
|
<b-col cols="8">{{ JSON.stringify(value) }}</b-col>
|
|
@@ -1876,6 +1990,23 @@ export default /*#__PURE__*/ {
|
|
|
1876
1990
|
</b-list-group>
|
|
1877
1991
|
</slot>
|
|
1878
1992
|
</b-modal>
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
<b-modal ref="modal-import" id="modal-import" title="Importar" hide-footer v-if="showImport">
|
|
1996
|
+
<slot name="import" v-bind:item="item" v-if="item">
|
|
1997
|
+
<b-overlay :show="loading" rounded="sm">
|
|
1998
|
+
<b-form-file v-model="fileImport" :state="Boolean(fileImport)" browse-text="Explorar"
|
|
1999
|
+
placeholder="Importar..." drop-placeholder="Arrastrar Archivo aquí..."></b-form-file>
|
|
2000
|
+
<div class="text-center mt-3">
|
|
2001
|
+
<b-button variant="info" v-on:click="importItems()" :disabled="loading">
|
|
2002
|
+
<b-icon-cloud-upload></b-icon-cloud-upload>
|
|
2003
|
+
{{ loading ? "Cargando..." : "Importar" }}
|
|
2004
|
+
</b-button>
|
|
2005
|
+
</div>
|
|
2006
|
+
</b-overlay>
|
|
2007
|
+
</slot>
|
|
2008
|
+
</b-modal>
|
|
2009
|
+
|
|
1879
2010
|
</div>
|
|
1880
2011
|
</template>
|
|
1881
2012
|
|
|
@@ -1888,10 +2019,10 @@ tr td:first-child {
|
|
|
1888
2019
|
|
|
1889
2020
|
.crud-pagination {
|
|
1890
2021
|
display: flex;
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
2022
|
+
align-items: center;
|
|
2023
|
+
width: 100%;
|
|
2024
|
+
justify-content: center;
|
|
2025
|
+
margin-top: 1rem;
|
|
1895
2026
|
}
|
|
1896
2027
|
|
|
1897
2028
|
.crud-header {
|