vue-laravel-crud 1.6.21 → 1.6.22
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 +138 -8
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +245 -111
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +292 -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 = [];
|
|
@@ -1460,10 +1540,10 @@ export default /*#__PURE__*/ {
|
|
|
1460
1540
|
:key="option.id ? option.id : option.value">
|
|
1461
1541
|
{{
|
|
1462
1542
|
option.text
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1543
|
+
? option.text
|
|
1544
|
+
: option.label
|
|
1545
|
+
? option.label
|
|
1546
|
+
: ""
|
|
1467
1547
|
}}
|
|
1468
1548
|
</option>
|
|
1469
1549
|
</select>
|
|
@@ -1480,10 +1560,10 @@ export default /*#__PURE__*/ {
|
|
|
1480
1560
|
:key="option.id ? option.id : option.value">
|
|
1481
1561
|
{{
|
|
1482
1562
|
option.text
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1563
|
+
? option.text
|
|
1564
|
+
: option.label
|
|
1565
|
+
? option.label
|
|
1566
|
+
: ""
|
|
1487
1567
|
}}
|
|
1488
1568
|
</option>
|
|
1489
1569
|
</template>
|
|
@@ -1519,11 +1599,18 @@ export default /*#__PURE__*/ {
|
|
|
1519
1599
|
v-bind:loading="loading">
|
|
1520
1600
|
<slot name="tableActionsPrepend" v-bind:loading="loading"> </slot>
|
|
1521
1601
|
|
|
1602
|
+
<b-button variant="info" v-b-modal.modal-import v-if="showImport">
|
|
1603
|
+
<b-icon-cloud-upload></b-icon-cloud-upload>{{ messageImport }}
|
|
1604
|
+
</b-button>
|
|
1605
|
+
<b-button variant="info" @click="exportItems()" v-if="showExport">
|
|
1606
|
+
<b-icon-cloud-download></b-icon-cloud-download>{{ messageExport }}
|
|
1607
|
+
</b-button>
|
|
1522
1608
|
<b-button variant="info" v-if="showPrincipalSortBtn" @click="togglePrincipalSort()" :disabled="loading">
|
|
1523
1609
|
<b-icon-sort-numeric-down v-if="principalSort"></b-icon-sort-numeric-down>
|
|
1524
1610
|
<b-icon-sort-numeric-up v-else></b-icon-sort-numeric-up>
|
|
1525
1611
|
</b-button>
|
|
1526
|
-
<b-button variant="danger" @click="confirmBulkDelete()"
|
|
1612
|
+
<b-button variant="danger" @click="confirmBulkDelete()"
|
|
1613
|
+
v-if="bulkDelete"><b-icon-trash></b-icon-trash></b-button>
|
|
1527
1614
|
<b-button variant="success" v-if="showCreateBtn" @click="createItem()" :disabled="loading">
|
|
1528
1615
|
<b-icon-plus></b-icon-plus>{{ messageNew }}
|
|
1529
1616
|
</b-button>
|
|
@@ -1563,7 +1650,7 @@ export default /*#__PURE__*/ {
|
|
|
1563
1650
|
filtersVisible &&
|
|
1564
1651
|
isColumnHasFilter(column) &&
|
|
1565
1652
|
internalFilterByProp(column.prop)
|
|
1566
|
-
|
|
1653
|
+
">
|
|
1567
1654
|
|
|
1568
1655
|
<div class="form-group">
|
|
1569
1656
|
<select v-if="column.type == 'boolean'" class="form-control form-control-md p-2"
|
|
@@ -1593,10 +1680,10 @@ export default /*#__PURE__*/ {
|
|
|
1593
1680
|
<option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
|
|
1594
1681
|
{{
|
|
1595
1682
|
option.text
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1683
|
+
? option.text
|
|
1684
|
+
: option.label
|
|
1685
|
+
? option.label
|
|
1686
|
+
: ""
|
|
1600
1687
|
}}
|
|
1601
1688
|
</option>
|
|
1602
1689
|
</select>
|
|
@@ -1608,17 +1695,18 @@ export default /*#__PURE__*/ {
|
|
|
1608
1695
|
<option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
|
|
1609
1696
|
{{
|
|
1610
1697
|
option.text
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1698
|
+
? option.text
|
|
1699
|
+
: option.label
|
|
1700
|
+
? option.label
|
|
1701
|
+
: ""
|
|
1615
1702
|
}}
|
|
1616
1703
|
</option>
|
|
1617
1704
|
</select>
|
|
1618
1705
|
|
|
1619
|
-
<b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all"
|
|
1706
|
+
<b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all"
|
|
1707
|
+
@change="toggleAll($event)">
|
|
1620
1708
|
</b-form-checkbox>
|
|
1621
|
-
|
|
1709
|
+
|
|
1622
1710
|
<b-form-checkbox v-else-if="column.type == 'select'" name="select-all" @change="toggleAll($event)">
|
|
1623
1711
|
</b-form-checkbox>
|
|
1624
1712
|
|
|
@@ -1629,16 +1717,18 @@ export default /*#__PURE__*/ {
|
|
|
1629
1717
|
</div>
|
|
1630
1718
|
</slot>
|
|
1631
1719
|
<span v-else-if="column.type == 'select'">
|
|
1632
|
-
|
|
1720
|
+
<b-form-checkbox name="select-all" @change="toggleAll($event)"></b-form-checkbox>
|
|
1633
1721
|
</span>
|
|
1634
1722
|
<span v-else>{{ column.label }}</span>
|
|
1635
1723
|
|
|
1636
1724
|
|
|
1637
|
-
<span
|
|
1638
|
-
|
|
1725
|
+
<span
|
|
1726
|
+
v-if="sortable && column.type != 'select' && column.type != 'checkbox' && internalFilterByProp(column.prop + '_sort')"
|
|
1727
|
+
class="sort-filter" @click="toggleSortFilter(column)"><b-icon-sort-down
|
|
1639
1728
|
v-if="!internalFilterByProp(column.prop + '_sort').value"></b-icon-sort-down><b-icon-sort-up
|
|
1640
1729
|
v-if="internalFilterByProp(column.prop + '_sort').value == 'ASC'"></b-icon-sort-up>
|
|
1641
|
-
<b-icon-sort-down
|
|
1730
|
+
<b-icon-sort-down
|
|
1731
|
+
v-if="internalFilterByProp(column.prop + '_sort').value == 'DESC'"></b-icon-sort-down>
|
|
1642
1732
|
</span>
|
|
1643
1733
|
</th>
|
|
1644
1734
|
</slot>
|
|
@@ -1664,19 +1754,19 @@ export default /*#__PURE__*/ {
|
|
|
1664
1754
|
<b-badge variant="success" v-if="itemValue(column, item) == 'true' ||
|
|
1665
1755
|
itemValue(column, item) == 1 ||
|
|
1666
1756
|
itemValue(column, item) == '1'
|
|
1667
|
-
|
|
1757
|
+
"><b-icon-check-circle></b-icon-check-circle></b-badge>
|
|
1668
1758
|
<b-badge variant="danger" v-if="!itemValue(column, item) ||
|
|
1669
1759
|
itemValue(column, item) == '0' ||
|
|
1670
1760
|
itemValue(column, item) == 'false'
|
|
1671
|
-
|
|
1761
|
+
"><b-icon-x-circle></b-icon-x-circle></b-badge>
|
|
1672
1762
|
</span>
|
|
1673
1763
|
<span v-else-if="column.type == 'date'">
|
|
1674
1764
|
{{
|
|
1675
1765
|
itemValue(column, item)
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1766
|
+
? moment(itemValue(column, item)).format(
|
|
1767
|
+
column.format ? column.format : 'L LT'
|
|
1768
|
+
)
|
|
1769
|
+
: itemValue(column, item)
|
|
1680
1770
|
}}
|
|
1681
1771
|
</span>
|
|
1682
1772
|
<span v-else-if="column.type == 'select'">
|
|
@@ -1730,76 +1820,75 @@ export default /*#__PURE__*/ {
|
|
|
1730
1820
|
</div>
|
|
1731
1821
|
|
|
1732
1822
|
<div v-if="displayMode == displayModes.MODE_CARDS">
|
|
1733
|
-
<draggable v-model="items" :group="draggableGroup" :draggable="orderable ? '.item' : '.none'"
|
|
1734
|
-
@
|
|
1735
|
-
|
|
1823
|
+
<draggable v-model="items" :group="draggableGroup" :draggable="orderable ? '.item' : '.none'" @start="drag = true"
|
|
1824
|
+
@end="drag = false" @sort="onSort()" @add="onDraggableAdded($event)" @change="onDraggableChange($event)"
|
|
1825
|
+
:options="draggableOptions">
|
|
1736
1826
|
<masonry
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
itemValue(column, item) == '1'
|
|
1827
|
+
:cols="{ default: 12 / colLg, 1400: 12 / colXl, 1200: 12 / colLg, 1000: 12 / colMd, 700: 12 / colSm, 400: 12 / colXs }"
|
|
1828
|
+
:gutter="{ default: '15px', 700: '15px' }">
|
|
1829
|
+
|
|
1830
|
+
<div v-for="(item, index) in itemsList" v-bind:key="index" class="item">
|
|
1831
|
+
<b-card :title="item.title" tag="article" class="mb-2 card-crud" :class="cardClass"
|
|
1832
|
+
:hideFooter="cardHideFooter">
|
|
1833
|
+
<slot name="card" v-bind:item="item">
|
|
1834
|
+
<div v-for="(column, indexc) in columns" :key="indexc">
|
|
1835
|
+
<b-card-text v-if="column.type != 'actions'">{{ column.label }}:
|
|
1836
|
+
<slot :name="'cell-' + column.prop" v-bind:item="item" v-bind:index="index" v-bind:itemindex="index"
|
|
1837
|
+
v-bind:columnindex="indexc">
|
|
1838
|
+
<span v-if="column.type == 'boolean'">
|
|
1839
|
+
<b-badge variant="success" v-if="itemValue(column, item) == 'true' ||
|
|
1840
|
+
itemValue(column, item) == 1 ||
|
|
1841
|
+
itemValue(column, item) == '1'
|
|
1753
1842
|
"><b-icon-check-circle></b-icon-check-circle></b-badge>
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1843
|
+
<b-badge variant="danger" v-if="!itemValue(column, item) ||
|
|
1844
|
+
itemValue(column, item) == '0' ||
|
|
1845
|
+
itemValue(column, item) == 'false'
|
|
1757
1846
|
"><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
|
-
|
|
1847
|
+
</span>
|
|
1848
|
+
<span v-else-if="column.type == 'date'">
|
|
1849
|
+
{{ itemValue(column, item) }}
|
|
1850
|
+
</span>
|
|
1851
|
+
<span v-else-if="column.type == 'state'">
|
|
1852
|
+
{{
|
|
1853
|
+
getStateValue(itemValue(column, item), column.options)
|
|
1854
|
+
}}
|
|
1855
|
+
</span>
|
|
1856
|
+
<span v-else-if="column.type == 'array'">
|
|
1857
|
+
{{
|
|
1858
|
+
getArrayValue(
|
|
1859
|
+
itemValue(column, item),
|
|
1860
|
+
column.displayProp,
|
|
1861
|
+
column.options
|
|
1862
|
+
)
|
|
1863
|
+
}}
|
|
1864
|
+
</span>
|
|
1865
|
+
<span v-else>
|
|
1866
|
+
{{ itemValue(column, item) }}
|
|
1867
|
+
</span>
|
|
1868
|
+
</slot>
|
|
1869
|
+
</b-card-text>
|
|
1870
|
+
</div>
|
|
1871
|
+
</slot>
|
|
1872
|
+
|
|
1873
|
+
<template v-slot:footer>
|
|
1874
|
+
<b-button-group>
|
|
1875
|
+
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
1876
|
+
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
1877
|
+
<b-button variant="primary" @click="showItem(item.id, index)">
|
|
1878
|
+
<b-icon-eye></b-icon-eye>
|
|
1879
|
+
</b-button>
|
|
1880
|
+
<b-button variant="secondary" @click="updateItem(item.id, index)">
|
|
1881
|
+
<b-icon-pencil></b-icon-pencil>
|
|
1882
|
+
</b-button>
|
|
1883
|
+
<b-button variant="danger" @click="removeItem(item.id, index)">
|
|
1884
|
+
<b-icon-trash></b-icon-trash>
|
|
1885
|
+
</b-button>
|
|
1779
1886
|
</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>
|
|
1887
|
+
</b-button-group>
|
|
1888
|
+
</template>
|
|
1889
|
+
</b-card>
|
|
1890
|
+
</div>
|
|
1891
|
+
</masonry>
|
|
1803
1892
|
</draggable>
|
|
1804
1893
|
|
|
1805
1894
|
<p v-if="!loading && items && items.length == 0 && !infiniteScroll" class="p-3">
|
|
@@ -1819,7 +1908,7 @@ export default /*#__PURE__*/ {
|
|
|
1819
1908
|
</div>
|
|
1820
1909
|
</div>
|
|
1821
1910
|
<b-overlay :show="loading" rounded="sm"></b-overlay>
|
|
1822
|
-
<infinite-loading ref="infiniteLoading" @infinite="infiniteHandler" v-if="infiniteScroll
|
|
1911
|
+
<infinite-loading ref="infiniteLoading" @infinite="infiniteHandler" v-if="infiniteScroll"
|
|
1823
1912
|
:forceUseInfiniteWrapper="true" :key="infiniteScrollKey">
|
|
1824
1913
|
<div slot="spinner">
|
|
1825
1914
|
<div class="text-center">{{ messageLoading }}</div>
|
|
@@ -1831,8 +1920,10 @@ export default /*#__PURE__*/ {
|
|
|
1831
1920
|
<div class="text-center" v-if="!loading">{{ items.length == 0 ? messageEmptyResults : messageNoMore }}</div>
|
|
1832
1921
|
</div>
|
|
1833
1922
|
</infinite-loading>
|
|
1834
|
-
<div class="paginator-data"
|
|
1835
|
-
Filas: {{ pagination.total }} |xPág: {{ pagination.per_page }} |Pág: {{ pagination.current_page }} |Seleccionados:
|
|
1923
|
+
<div class="paginator-data" v-if="!infiniteScroll">
|
|
1924
|
+
Filas: {{ pagination.total }} |xPág: {{ pagination.per_page }} |Pág: {{ pagination.current_page }} |Seleccionados:
|
|
1925
|
+
{{
|
|
1926
|
+
selectedItems.length }}
|
|
1836
1927
|
</div>
|
|
1837
1928
|
<div class="crud-paginator" v-if="!infiniteScroll">
|
|
1838
1929
|
<b-pagination v-if="showPaginator" v-model="pagination.current_page" :total-rows="pagination.total"
|
|
@@ -1854,7 +1945,7 @@ export default /*#__PURE__*/ {
|
|
|
1854
1945
|
</template>
|
|
1855
1946
|
<template v-if="!validate">
|
|
1856
1947
|
<slot name="form" v-bind:item="item" v-if="item">
|
|
1857
|
-
<b-form-group :label="key" v-for="(value, key) in
|
|
1948
|
+
<b-form-group :label="key" v-for="(value, key) in item" :key="key">
|
|
1858
1949
|
<b-form-input v-model="item[key]" type="text" required></b-form-input>
|
|
1859
1950
|
</b-form-group>
|
|
1860
1951
|
</slot>
|
|
@@ -1867,7 +1958,7 @@ export default /*#__PURE__*/ {
|
|
|
1867
1958
|
<b-modal :id="'modal-show-item-' + modelName" hide-footer size="xl" :title="title" no-close-on-backdrop>
|
|
1868
1959
|
<slot name="show" v-bind:item="item" v-if="item">
|
|
1869
1960
|
<b-list-group>
|
|
1870
|
-
<b-list-group-item v-for="(value, key) in
|
|
1961
|
+
<b-list-group-item v-for="(value, key) in item" :key="key">
|
|
1871
1962
|
<b-row class="w-100">
|
|
1872
1963
|
<b-col cols="4" class="font-weight-bold">{{ key }}</b-col>
|
|
1873
1964
|
<b-col cols="8">{{ JSON.stringify(value) }}</b-col>
|
|
@@ -1876,6 +1967,23 @@ export default /*#__PURE__*/ {
|
|
|
1876
1967
|
</b-list-group>
|
|
1877
1968
|
</slot>
|
|
1878
1969
|
</b-modal>
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
<b-modal ref="modal-import" id="modal-import" title="Importar" hide-footer v-if="showImport">
|
|
1973
|
+
<slot name="import" v-bind:item="item" v-if="item">
|
|
1974
|
+
<b-overlay :show="loading" rounded="sm">
|
|
1975
|
+
<b-form-file v-model="fileImport" :state="Boolean(fileImport)" browse-text="Explorar"
|
|
1976
|
+
placeholder="Importar..." drop-placeholder="Arrastrar Archivo aquí..."></b-form-file>
|
|
1977
|
+
<div class="text-center mt-3">
|
|
1978
|
+
<b-button variant="info" v-on:click="importItems()" :disabled="loading">
|
|
1979
|
+
<b-icon-cloud-upload></b-icon-cloud-upload>
|
|
1980
|
+
{{ loading ? "Cargando..." : "Importar" }}
|
|
1981
|
+
</b-button>
|
|
1982
|
+
</div>
|
|
1983
|
+
</b-overlay>
|
|
1984
|
+
</slot>
|
|
1985
|
+
</b-modal>
|
|
1986
|
+
|
|
1879
1987
|
</div>
|
|
1880
1988
|
</template>
|
|
1881
1989
|
|
|
@@ -1888,10 +1996,10 @@ tr td:first-child {
|
|
|
1888
1996
|
|
|
1889
1997
|
.crud-pagination {
|
|
1890
1998
|
display: flex;
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1999
|
+
align-items: center;
|
|
2000
|
+
width: 100%;
|
|
2001
|
+
justify-content: center;
|
|
2002
|
+
margin-top: 1rem;
|
|
1895
2003
|
}
|
|
1896
2004
|
|
|
1897
2005
|
.crud-header {
|