fix pagination

This commit is contained in:
saji_kk
2024-09-05 15:59:30 +03:30
parent 789d378f7b
commit c11ae8a447
5 changed files with 13439 additions and 8758 deletions
+9041 -4348
View File
File diff suppressed because it is too large Load Diff
+36 -74
View File
@@ -5,67 +5,34 @@
<v-layout align-center wrap class="px-5 my-3">
<v-flex xs12 md2 sm3 class="WM-FlexCenter">
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
class="py-3 pr-3"
v-model="filter.cycle_id"
label="Cycle ID"
color="black"
></v-text-field>
<v-text-field class="py-3 pr-3" v-model="filter.cycle_id" label="Cycle ID"
color="black"></v-text-field>
</v-flex>
<v-flex xs12 md2 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
class="py-3 pr-3"
v-model="filter.sterilizer_id"
label="Sterilizer ID"
color="black"
></v-text-field>
<v-text-field class="py-3 pr-3" v-model="filter.sterilizer_id" label="Sterilizer ID"
color="black"></v-text-field>
</v-flex>
<v-flex xs12 md2 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
class="py-3 pr-3"
v-model="filter.cycle_number"
label="Cycle Number"
color="black"
></v-text-field>
<v-text-field class="py-3 pr-3" v-model="filter.cycle_number" label="Cycle Number"
color="black"></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3" v-if="$hasRole('Admin')">
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
class="py-3 pr-3"
v-model="filter.medical_center_id"
item-text="name"
item-value="id"
label="Hospital"
color="black"
:items="medicalCenters"
:clearable="true"
></v-autocomplete>
<v-autocomplete class="py-3 pr-3" v-model="filter.medical_center_id" item-text="name"
item-value="id" label="Hospital" color="black" :items="medicalCenters"
:clearable="true"></v-autocomplete>
</v-flex>
<v-flex xs12 sm2 md2 class="WM-FlexCenter pl-3">
<v-icon class="far fa-calendar-alt mr-2 WM-Margin-B-8"></v-icon>
<v-menu
lazy
:close-on-content-click="true"
transition="v-scale-transition"
offset-y
v-model="Menu"
>
<v-text-field style="padding-top:0 !important"
required
slot="activator"
label="Date"
color="black"
class=""
v-model="filter.date">
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y
v-model="Menu">
<v-text-field style="padding-top:0 !important" required slot="activator" label="Date"
color="black" class="" v-model="filter.date">
</v-text-field>
<v-date-picker
color="pink"
no-title
v-model="filter.date"
:date-format="date => new Date(date).toDateString()"
></v-date-picker>
<v-date-picker color="pink" no-title v-model="filter.date"
:date-format="date => new Date(date).toDateString()"></v-date-picker>
</v-menu>
</v-flex>
<v-flex class xs12 md2 sm3>
@@ -91,23 +58,21 @@
<v-flex md12>
<v-data-table :headers="headers" :items="packages" hide-actions>
<template slot="headerCell" slot-scope="{ header }">
<span
class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"
/>
<span class="subheading font-weight-light text-white text--darken-3"
v-text="header.text" />
</template>
<template slot="items" slot-scope="{ item }">
<td class="headline font-weight-light">{{ item.id }}</td>
<td
class="title font-weight-light"
>{{ (item.user && item.user.medical_center) ? item.user.medical_center.name : '' }}</td>
<td class="title font-weight-light">{{ (item.user && item.user.medical_center) ?
item.user.medical_center.name : '' }}</td>
<td class="title font-weight-light">{{ item.sterilizer_id }}</td>
<td class="title font-weight-light">{{ item.cycle_number }}</td>
<td class="title font-weight-light">{{ item.date }}</td>
<td class="text-xs-right FlexBtn Height-MD-60">
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="cyan" class="mr-2" @click="show(item.id)">
<v-btn v-bind="attrs" v-on="on" color="cyan" class="mr-2"
@click="show(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
@@ -116,11 +81,9 @@
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<router-link
class="LinkBtn"
<router-link class="LinkBtn"
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
:to="{name: 'EditCycle', params: {cycle: item.id}}"
>
:to="{ name: 'EditCycle', params: { cycle: item.id } }">
<v-btn v-bind="attrs" v-on="on" color="orange" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
@@ -131,13 +94,9 @@
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs" v-on="on"
color="pink"
class="WM-ActionButton mr-2"
<v-btn v-bind="attrs" v-on="on" color="pink" class="WM-ActionButton mr-2"
@click="remove(item.id)"
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
>
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id">
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
@@ -146,9 +105,7 @@
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs" v-on="on"
color="orange darken-1"
<v-btn v-bind="attrs" v-on="on" color="orange darken-1"
@click="generateBarcode(item.id, 'Cycle')">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
@@ -163,7 +120,8 @@
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center mt-2" v-if="lastPage > 1">
<v-pagination color="black" v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
<v-pagination color="black" v-model="currentPage" :length="lastPage"
:total-visible="6"></v-pagination>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/dashboard">
@@ -241,9 +199,10 @@ export default {
urls.listCycle(filter)
);
if (result && result.status == 200) {
this.packages = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
const { data, meta } = result.data;
this.packages = data;
this.currentPage = meta.current_page;
this.lastPage = meta.last_page;
}
this.loadMedicalCenters();
},
@@ -303,10 +262,13 @@ export default {
.v-btn--floating {
padding: 0 !important;
}
.theme--light.v-btn.v-btn--flat {
color: rgba(0, 0, 0, .87) !important;
}
.v-btn--floating, .v-btn--icon:before {
.v-btn--floating,
.v-btn--icon:before {
border-radius: 50% !important;
}
</style>
+4 -3
View File
@@ -195,9 +195,10 @@ export default {
filter += page ? `page=${page}` : `page=1`;
const result = await ApiService.get(urls.listLabel(filter));
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
const { data, meta } = result.data;
this.items = data;
this.currentPage = meta.current_page;
this.lastPage = meta.last_page;
}
this.loadMedicalCenters();
},
+4 -3
View File
@@ -208,9 +208,10 @@ export default {
urls.listPackage(filter)
);
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
const { data, meta } = result.data;
this.items = data;
this.currentPage = meta.current_page;
this.lastPage = meta.last_page;
}
this.loadMedicalCenters();
},
+45 -21
View File
@@ -5,36 +5,49 @@
<v-layout align-center wrap class="px-5 mb-3 my-3">
<v-flex xs12 md2 sm3 class="WM-FlexCenter">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field class="py-3 pr-3" v-model="filter.device_id" label="ID" color="black"></v-text-field>
<v-text-field class="py-3 pr-3" v-model="filter.device_id" label="ID"
color="black"></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete :items="deviceLabels" item-text="name" item-value="id" v-model="filter.device_label" label="ID Label" color="black" class="py-3 pr-3" :clearable="true"></v-autocomplete>
<v-autocomplete :items="deviceLabels" item-text="name" item-value="id"
v-model="filter.device_label" label="ID Label" color="black" class="py-3 pr-3"
:clearable="true"></v-autocomplete>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete class="py-3 pr-3" v-model="filter.testType_id" label="TestType Name" color="black" :items="testTypes" item-text="name" item-value="id"></v-autocomplete>
<v-autocomplete class="py-3 pr-3" v-model="filter.testType_id" label="TestType Name"
color="black" :items="testTypes" item-text="name" item-value="id"></v-autocomplete>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete class="py-3 pr-3" v-model="filter.medicalCenter_id" label="Hospital" color="black" :items="medicalCenters" item-text="name" item-value="id" :clearable="true"></v-autocomplete>
<v-autocomplete class="py-3 pr-3" v-model="filter.medicalCenter_id" label="Hospital"
color="black" :items="medicalCenters" item-text="name" item-value="id"
:clearable="true"></v-autocomplete>
</v-flex>
<v-flex xs12 md2 sm3 class="WM-FlexCenter">
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"></v-icon>
<v-text-field class="py-3 pr-3" v-model="filter.user_name" label="User Name" color="black"></v-text-field>
<v-text-field class="py-3 pr-3" v-model="filter.user_name" label="User Name"
color="black"></v-text-field>
</v-flex>
<v-flex xs12 sm6 md2 pl-3 class="WM-FlexCenter">
<v-icon class="far fa-calendar-alt mr-2"></v-icon>
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y v-model="fromMenu">
<v-text-field class="py-3 pr-3" required slot="activator" label="FromDate" v-model="filter.fromPicker" color="black"></v-text-field>
<v-date-picker color="pink" no-title v-model="filter.fromPicker" :date-format="date => new Date(date).toDateString()"></v-date-picker>
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y
v-model="fromMenu">
<v-text-field class="py-3 pr-3" required slot="activator" label="FromDate"
v-model="filter.fromPicker" color="black"></v-text-field>
<v-date-picker color="pink" no-title v-model="filter.fromPicker"
:date-format="date => new Date(date).toDateString()"></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12 sm6 md2 pl-3 style="display: flex;align-items: center;">
<v-icon class="far fa-calendar-alt mr-2"></v-icon>
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y v-model="upToMenu">
<v-text-field class="py-3 pr-3" required slot="activator" label="UpToDate" color="black" v-model="filter.upToPicker"></v-text-field>
<v-date-picker color="pink" no-title v-model="filter.upToPicker" :date-format="date => new Date(date).toDateString()"></v-date-picker>
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y
v-model="upToMenu">
<v-text-field class="py-3 pr-3" required slot="activator" label="UpToDate" color="black"
v-model="filter.upToPicker"></v-text-field>
<v-date-picker color="pink" no-title v-model="filter.upToPicker"
:date-format="date => new Date(date).toDateString()"></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-XL-Align-L text-lg-left">
@@ -77,11 +90,13 @@
<v-flex md12>
<v-data-table :headers="headers" :items="items" hide-actions>
<template slot="headerCell" slot-scope="{ header }">
<span class="subheading font-weight-light text-white text--darken-3" v-text="header.text" />
<span class="subheading font-weight-light text-white text--darken-3"
v-text="header.text" />
</template>
<template slot="items" slot-scope="{ item }">
<td class="headline font-weight-light">{{ item.id }}</td>
<td class="title font-weight-light">{{ item.test_type ? item.test_type.name : 'Archived Test' }}</td>
<td class="title font-weight-light">{{ item.test_type ? item.test_type.name : 'Archived
Test' }}</td>
<td class="title font-weight-light">{{ item.user.medical_center.name }}</td>
<td class="title font-weight-light">{{ item.user.name }}</td>
<td class="title font-weight-light">
@@ -105,7 +120,8 @@
<td class="text-xs-right FlexBtn">
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn color="cyan" class="mr-2" @click="show(item.id)" v-bind="attrs" v-on="on">
<v-btn color="cyan" class="mr-2" @click="show(item.id)" v-bind="attrs"
v-on="on">
<v-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
@@ -114,7 +130,9 @@
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn color="orange" class="mr-2" @click="generateBarcode(item.id, 'TestResult')" v-bind="attrs" v-on="on">
<v-btn color="orange" class="mr-2"
@click="generateBarcode(item.id, 'TestResult')" v-bind="attrs"
v-on="on">
<v-icon class="white--text mr-1 caption">fa fa-bars</v-icon>
<span>generate Barcode</span>
</v-btn>
@@ -124,7 +142,9 @@
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" -->
<router-link class="LinkBtn" v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')" :to="{name: 'EditTestResult', params: {testResult: item.id}}">
<router-link class="LinkBtn"
v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')"
:to="{ name: 'EditTestResult', params: { testResult: item.id } }">
<v-btn color="orange" class="mr-2" v-bind="attrs" v-on="on">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
@@ -136,7 +156,9 @@
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" -->
<v-btn color="pink" class="WM-ActionButton" @click="remove(item.id)" v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')" v-bind="attrs" v-on="on">
<v-btn color="pink" class="WM-ActionButton" @click="remove(item.id)"
v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')"
v-bind="attrs" v-on="on">
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
@@ -150,7 +172,8 @@
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center mt-2" v-if="lastPage > 1">
<v-pagination color="black" v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
<v-pagination color="black" v-model="currentPage" :length="lastPage"
:total-visible="6"></v-pagination>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/dashboard">
@@ -311,9 +334,10 @@ export default {
urls.listTestResult(filter)
);
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
const { data, meta } = result.data;
this.items = data;
this.currentPage = meta.current_page;
this.lastPage = meta.last_page;
}
},
async show(testResultId) {