Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added selected count on Mass Action #7437

Merged
merged 4 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/Webkul/Ui/publishable/assets/css/ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/Webkul/Ui/publishable/assets/js/ui.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public function getTranslations()
'active' => __('ui::app.datagrid.active'),
'inactive' => __('ui::app.datagrid.inactive'),
'clearAll' => __('ui::app.datagrid.clear-all'),
'of' => __('ui::app.datagrid.of'),
'selected' => __('ui::app.datagrid.selected'),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
:data-id="indexes"
:mass-actions-toggle="massActionsToggle"
:extra-filters="extraFilters"
:item-count="itemCount"
:total = records.total
@onRemoveFilter="removeFilter($event)"
@onRemoveAllFilter="clearAllFilters()"
></datagrid-filter-tags>
Expand Down Expand Up @@ -122,7 +124,8 @@ export default {
massActionTargets: [],
url: this.src,
indexes: [],
massActionsToggle:false
massActionsToggle: false,
itemCount: 0
};
},

Expand Down Expand Up @@ -194,6 +197,8 @@ export default {
.catch(function (error) {
console.log(error);
});

this.itemCount = 0;
},

initResponseProps(results) {
Expand Down Expand Up @@ -489,12 +494,15 @@ export default {
})
}

this.itemCount = dataIds[2];

this.massActionsToggle = dataIds[1];
},

massActionToggle(massAction) {
this.indexes = massAction[0];
this.massActionsToggle = massAction[1];
this.itemCount = massAction[2];
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
style="margin-left: 10px; white-space: nowrap;"
></button>
</form>

<div class="item-count" v-if="itemCount"> {{ itemCount }} {{ translations.of }} {{ total }} {{ translations.selected }}</div>

<template v-if="filters.length > 0">
<datagrid-filter-tag
Expand All @@ -107,7 +109,9 @@ export default {
'massActionTargets',
'dataId',
'massActionsToggle',
'extraFilters'
'extraFilters',
'itemCount',
'total'
],

components: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default {
massActionTarget: null,
massActionsToggle: false,
massActionType: this.getDefaultMassActionType(),
itemSelected: 0
};
},

Expand All @@ -172,7 +173,9 @@ export default {
this.massActionsToggle = true;
}

this.$emit('onSelect', [dataIds, this.massActionsToggle]);
this.itemSelected = this.dataIds.length;

this.$emit('onSelect', [dataIds, this.massActionsToggle, this.itemSelected]);
},

selectAll() {
Expand Down Expand Up @@ -217,7 +220,9 @@ export default {
this.removeMassActions();
}

this.$emit('onSelectAll', [this.dataIds, this.massActionsToggle]);
this.itemSelected = this.dataIds.length;

this.$emit('onSelectAll', [this.dataIds, this.massActionsToggle, this.itemSelected]);
},

getDefaultMassActionType: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@

.filtered-tags {
display: inline-flex;
align-items: flex-start;
align-items: center;
flex-wrap: wrap;
margin-bottom: 10px;

p {
cursor: pointer;
}

.item-count {
margin-left: 10px;
}
}

.search-filter {
Expand Down
4 changes: 3 additions & 1 deletion packages/Webkul/Ui/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'all-locales' => 'All Locales',
'all-customer-groups' => 'All Customer groups',
'records-found' => 'Record(s) found',
'clear-all' => 'Clear All'
'clear-all' => 'Clear All',
'of' => 'of',
'selected' => 'selected',
],
];