Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion resources/js/components/requests/requestModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
hide-footer
:title="$t('New Case')"
:size="size"
@hidden="hideModal"
>
<progress-loader
ref="progressLoader"
Expand Down Expand Up @@ -171,10 +172,21 @@ export default {
},
showModal() {
this.loaded = true;
// Perform initial load of requests from backend
this.$refs.requestModalAdd.show();
this.fetch();
},
hideModal() {
this.loaded = false;
this.filter = "";
this.error = false;
this.processes = {};
this.page = 1;
this.perPage = 15;
const pagination = this.$refs.listProcess;
if (pagination && String(pagination.perPage) !== "15") {
pagination.perPage = "15";
}
},
// Overwrite handler to change the page based on events fired
onPageChange: function onPageChange(page) {
if (page === "next") {
Expand All @@ -192,6 +204,19 @@ export default {
}
this.fetch();
},
changePerPage(value) {
Comment thread
mcraeteisha marked this conversation as resolved.
const perPage = Number(value);
this.perPage = perPage;
const pagination = this.$refs.listProcess ? this.$refs.listProcess.tablePagination : null;
const total = pagination && pagination.total ? pagination.total : 0;
if (total > 0 && this.page * perPage > total) {
this.page = Math.ceil(total / perPage);
}
if (this.page <= 0) {
this.page = 1;
}
this.fetch();
},
fetch() {
if (!this.loaded) {
return;
Expand Down
Loading