feat: add search and sorting to shipping zones table (#157)
- Add search filter input to zones table - Make all columns sortable with default sort by name - Fix country list: alphabetize, remove asterisks from UK/US, remove "Flat rate" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bd010ece6b
commit
0e2cad101d
2 changed files with 31 additions and 11 deletions
|
|
@ -6,6 +6,7 @@ window.app.component('shipping-zones-list', {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
zones: [],
|
zones: [],
|
||||||
|
filter: '',
|
||||||
zoneDialog: {
|
zoneDialog: {
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -19,7 +20,6 @@ window.app.component('shipping-zones-list', {
|
||||||
currencies: [],
|
currencies: [],
|
||||||
shippingZoneOptions: [
|
shippingZoneOptions: [
|
||||||
'Free (digital)',
|
'Free (digital)',
|
||||||
'Flat rate',
|
|
||||||
'Worldwide',
|
'Worldwide',
|
||||||
'Europe',
|
'Europe',
|
||||||
'Australia',
|
'Australia',
|
||||||
|
|
@ -27,6 +27,7 @@ window.app.component('shipping-zones-list', {
|
||||||
'Belgium',
|
'Belgium',
|
||||||
'Brazil',
|
'Brazil',
|
||||||
'Canada',
|
'Canada',
|
||||||
|
'China',
|
||||||
'Denmark',
|
'Denmark',
|
||||||
'Finland',
|
'Finland',
|
||||||
'France',
|
'France',
|
||||||
|
|
@ -34,8 +35,8 @@ window.app.component('shipping-zones-list', {
|
||||||
'Greece',
|
'Greece',
|
||||||
'Hong Kong',
|
'Hong Kong',
|
||||||
'Hungary',
|
'Hungary',
|
||||||
'Ireland',
|
|
||||||
'Indonesia',
|
'Indonesia',
|
||||||
|
'Ireland',
|
||||||
'Israel',
|
'Israel',
|
||||||
'Italy',
|
'Italy',
|
||||||
'Japan',
|
'Japan',
|
||||||
|
|
@ -59,10 +60,9 @@ window.app.component('shipping-zones-list', {
|
||||||
'Thailand',
|
'Thailand',
|
||||||
'Turkey',
|
'Turkey',
|
||||||
'Ukraine',
|
'Ukraine',
|
||||||
'United Kingdom**',
|
'United Kingdom',
|
||||||
'United States***',
|
'United States',
|
||||||
'Vietnam',
|
'Vietnam'
|
||||||
'China'
|
|
||||||
],
|
],
|
||||||
zonesTable: {
|
zonesTable: {
|
||||||
columns: [
|
columns: [
|
||||||
|
|
@ -70,25 +70,29 @@ window.app.component('shipping-zones-list', {
|
||||||
name: 'name',
|
name: 'name',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
field: 'name'
|
field: 'name',
|
||||||
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'countries',
|
name: 'countries',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: 'Countries',
|
label: 'Countries',
|
||||||
field: 'countries'
|
field: 'countries',
|
||||||
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'currency',
|
name: 'currency',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: 'Currency',
|
label: 'Currency',
|
||||||
field: 'currency'
|
field: 'currency',
|
||||||
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cost',
|
name: 'cost',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: 'Cost',
|
label: 'Cost',
|
||||||
field: 'cost'
|
field: 'cost',
|
||||||
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'actions',
|
name: 'actions',
|
||||||
|
|
@ -98,7 +102,9 @@ window.app.component('shipping-zones-list', {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pagination: {
|
pagination: {
|
||||||
rowsPerPage: 10
|
rowsPerPage: 10,
|
||||||
|
sortBy: 'name',
|
||||||
|
descending: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,18 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="row items-center q-mb-md q-col-gutter-sm justify-end">
|
<div class="row items-center q-mb-md q-col-gutter-sm justify-end">
|
||||||
|
<div class="col-auto">
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
debounce="300"
|
||||||
|
v-model="filter"
|
||||||
|
placeholder="Search zones..."
|
||||||
|
style="min-width: 200px"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon name="search"></q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<q-btn
|
<q-btn
|
||||||
unelevated
|
unelevated
|
||||||
|
|
@ -19,6 +32,7 @@
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:columns="zonesTable.columns"
|
:columns="zonesTable.columns"
|
||||||
v-model:pagination="zonesTable.pagination"
|
v-model:pagination="zonesTable.pagination"
|
||||||
|
:filter="filter"
|
||||||
>
|
>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue