Skip to content

Commit 3eab9b4

Browse files
committed
Update
- Added : label on crud table to see the items displayed and total items available
1 parent d2d4ef0 commit 3eab9b4

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

resources/ts/components/ns-crud.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ const nsCrud = Vue.component( 'ns-crud', {
7676
return `&page=${this.page}`
7777
}
7878
return '';
79+
},
80+
resultInfo() {
81+
return __( 'displaying {perPage} on {items} items' )
82+
.replace( '{perPage}', this.result.total )
83+
.replace( '{items}', this.result.total )
7984
}
8085
},
8186
methods: {
@@ -339,24 +344,27 @@ const nsCrud = Vue.component( 'ns-crud', {
339344
<div class="p-2 flex flex-col md:flex-row justify-between">
340345
<div v-if="bulkActions.length > 0" id="grouped-actions" class="mb-2 md:mb-0 flex justify-between rounded-full bg-gray-200 p-1">
341346
<select class="text-gray-800 outline-none bg-transparent" v-model="bulkAction" id="grouped-actions">
342-
<option selected value=""><slot name="bulk-label">bulk-label</slot></option>
347+
<option selected value=""><slot name="bulk-label">{{ __( 'Bulk Actions' ) }}</slot></option>
343348
<option v-for="action of bulkActions" :value="action.identifier">{{ action.label }}</option>
344349
</select>
345-
<button @click="bulkDo()" class="h-8 w-8 outline-none hover:bg-blue-400 hover:text-white rounded-full bg-white flex items-center justify-center"><slot name="bulk-go">Go</slot></button>
350+
<button @click="bulkDo()" class="h-8 w-8 outline-none hover:bg-blue-400 hover:text-white rounded-full bg-white flex items-center justify-center"><slot name="bulk-go">{{ __( 'Go' ) }}</slot></button>
346351
</div>
347-
<div id="pagination" class="flex -mx-1">
348-
<template v-if="result.current_page">
349-
<a href="javascript:void(0)" @click="page=result.first_page;refresh()" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full bg-gray-200 text-gray-700 hover:bg-blue-400 hover:text-white shadow">
350-
<i class="las la-angle-double-left"></i>
351-
</a>
352-
<template v-for="_paginationPage of pagination">
353-
<a v-if="page !== '...'" :class="page == _paginationPage ? 'bg-blue-400 text-white' : 'bg-gray-200 text-gray-700'" @click="page=_paginationPage;refresh()" href="javascript:void(0)" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full hover:bg-blue-400 hover:text-white">{{ _paginationPage }}</a>
354-
<a v-if="page === '...'" href="javascript:void(0)" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full bg-gray-200 text-gray-700">...</a>
352+
<div class="flex">
353+
<div class="items-center flex text-gray-600 mx-4">{{ resultInfo }}</div>
354+
<div id="pagination" class="flex -mx-1">
355+
<template v-if="result.current_page">
356+
<a href="javascript:void(0)" @click="page=result.first_page;refresh()" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full bg-gray-200 text-gray-700 hover:bg-blue-400 hover:text-white shadow">
357+
<i class="las la-angle-double-left"></i>
358+
</a>
359+
<template v-for="_paginationPage of pagination">
360+
<a v-if="page !== '...'" :class="page == _paginationPage ? 'bg-blue-400 text-white' : 'bg-gray-200 text-gray-700'" @click="page=_paginationPage;refresh()" href="javascript:void(0)" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full hover:bg-blue-400 hover:text-white">{{ _paginationPage }}</a>
361+
<a v-if="page === '...'" href="javascript:void(0)" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full bg-gray-200 text-gray-700">...</a>
362+
</template>
363+
<a href="javascript:void(0)" @click="page=result.last_page;refresh()" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full bg-gray-200 text-gray-700 hover:bg-blue-400 hover:text-white shadow">
364+
<i class="las la-angle-double-right"></i>
365+
</a>
355366
</template>
356-
<a href="javascript:void(0)" @click="page=result.last_page;refresh()" class="mx-1 flex items-center justify-center h-8 w-8 rounded-full bg-gray-200 text-gray-700 hover:bg-blue-400 hover:text-white shadow">
357-
<i class="las la-angle-double-right"></i>
358-
</a>
359-
</template>
367+
</div>
360368
</div>
361369
</div>
362370
</div>

0 commit comments

Comments
 (0)