feat: Save sort Conversations filter (#8237)
This commit is contained in:
@@ -207,6 +207,7 @@ import DeleteCustomViews from 'dashboard/routes/dashboard/customviews/DeleteCust
|
|||||||
import ConversationBulkActions from './widgets/conversation/conversationBulkActions/Index.vue';
|
import ConversationBulkActions from './widgets/conversation/conversationBulkActions/Index.vue';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
import filterMixin from 'shared/mixins/filterMixin';
|
import filterMixin from 'shared/mixins/filterMixin';
|
||||||
|
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||||
import languages from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
import languages from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
||||||
import countries from 'shared/constants/countries';
|
import countries from 'shared/constants/countries';
|
||||||
import { generateValuesForEditCustomViews } from 'dashboard/helper/customViewsHelper';
|
import { generateValuesForEditCustomViews } from 'dashboard/helper/customViewsHelper';
|
||||||
@@ -238,6 +239,7 @@ export default {
|
|||||||
eventListenerMixins,
|
eventListenerMixins,
|
||||||
alertMixin,
|
alertMixin,
|
||||||
filterMixin,
|
filterMixin,
|
||||||
|
uiSettingsMixin,
|
||||||
],
|
],
|
||||||
props: {
|
props: {
|
||||||
conversationInbox: {
|
conversationInbox: {
|
||||||
@@ -514,6 +516,9 @@ export default {
|
|||||||
this.chatsOnView = this.conversationList;
|
this.chatsOnView = this.conversationList;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.setFiltersFromUISettings();
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.dispatch('setChatStatusFilter', this.activeStatus);
|
this.$store.dispatch('setChatStatusFilter', this.activeStatus);
|
||||||
this.$store.dispatch('setChatSortFilter', this.activeSortBy);
|
this.$store.dispatch('setChatSortFilter', this.activeSortBy);
|
||||||
@@ -544,6 +549,12 @@ export default {
|
|||||||
this.$store.dispatch('customViews/update', payloadData);
|
this.$store.dispatch('customViews/update', payloadData);
|
||||||
this.closeAdvanceFiltersModal();
|
this.closeAdvanceFiltersModal();
|
||||||
},
|
},
|
||||||
|
setFiltersFromUISettings() {
|
||||||
|
const { status, order_by: orderBy } =
|
||||||
|
this.uiSettings.conversations_filter_by;
|
||||||
|
this.activeStatus = status || wootConstants.STATUS_TYPE.OPEN;
|
||||||
|
this.activeSortBy = orderBy || wootConstants.SORT_BY_TYPE.LATEST;
|
||||||
|
},
|
||||||
onClickOpenAddFoldersModal() {
|
onClickOpenAddFoldersModal() {
|
||||||
this.showAddFoldersModal = true;
|
this.showAddFoldersModal = true;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
}}</span>
|
}}</span>
|
||||||
<filter-item
|
<filter-item
|
||||||
type="sort"
|
type="sort"
|
||||||
:selected-value="chatSortFilter"
|
:selected-value="sortFilter"
|
||||||
:items="chatSortItems"
|
:items="chatSortItems"
|
||||||
path-prefix="CHAT_LIST.CHAT_SORT_FILTER_ITEMS"
|
path-prefix="CHAT_LIST.CHAT_SORT_FILTER_ITEMS"
|
||||||
@onChangeFilter="onChangeFilter"
|
@onChangeFilter="onChangeFilter"
|
||||||
@@ -47,12 +47,13 @@ import wootConstants from 'dashboard/constants/globals';
|
|||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { mixin as clickaway } from 'vue-clickaway';
|
import { mixin as clickaway } from 'vue-clickaway';
|
||||||
import FilterItem from './FilterItem.vue';
|
import FilterItem from './FilterItem.vue';
|
||||||
|
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
FilterItem,
|
FilterItem,
|
||||||
},
|
},
|
||||||
mixins: [clickaway],
|
mixins: [clickaway, uiSettingsMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showActionsDropdown: false,
|
showActionsDropdown: false,
|
||||||
@@ -83,8 +84,17 @@ export default {
|
|||||||
closeDropdown() {
|
closeDropdown() {
|
||||||
this.showActionsDropdown = false;
|
this.showActionsDropdown = false;
|
||||||
},
|
},
|
||||||
onChangeFilter(type, value) {
|
onChangeFilter(value, type) {
|
||||||
this.$emit('changeFilter', type, value);
|
this.$emit('changeFilter', value, type);
|
||||||
|
this.saveSelectedFilter(type, value);
|
||||||
|
},
|
||||||
|
saveSelectedFilter(type, value) {
|
||||||
|
this.updateUISettings({
|
||||||
|
conversations_filter_by: {
|
||||||
|
status: type === 'status' ? value : this.chatStatus,
|
||||||
|
order_by: type === 'sort' ? value : this.sortFilter,
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user