- Invoice sorting refactored

- Frontend build
This commit is contained in:
Peter Papp
2021-05-11 10:57:30 +02:00
parent a7a6ef9f0a
commit e8ca132a8b
99 changed files with 311 additions and 242 deletions

View File

@@ -45,15 +45,7 @@
<PopoverWrapper>
<ToolbarButton @click.stop.native="showSortingMenu" source="preview-sorting" :action="$t('actions.sorting_view')" />
<PopoverItem name="desktop-sorting" side="left">
<OptionGroup v-if="$isThisLocation(['regular-invoice', 'advance-invoice'])">
<Option @click.native.stop="sort('created_at')" :title="$t('preview_sorting.sort_date')" icon="calendar" />
<Option @click.native.stop="sort('total_net')" :title="$t('in.sort_by_net')" icon="dollar" />
<Option @click.native.stop="sort('invoice_number')" :title="$t('in.sort_by_invoice_number')" icon="file-text" />
</OptionGroup>
<OptionGroup v-if="$isThisLocation('clients')">
<Option @click.native.stop="sort('created_at')" :title="$t('preview_sorting.sort_date')" icon="calendar" />
<Option @click.native.stop="sort('name')" :title="$t('preview_sorting.sort_alphabet')" icon="alphabet" />
</OptionGroup>
<InvoiceSortingOptions />
</PopoverItem>
</PopoverWrapper>
<ToolbarButton @click.native="$store.dispatch('fileInfoToggle')" :class="{'active': isVisibleSidebar }" :action="$t('actions.info_panel')" source="info" />
@@ -64,7 +56,7 @@
</template>
<script>
import FileSortingOptions from '@/components/FilesView/FileSortingOptions'
import InvoiceSortingOptions from '@/Oasis/Invoices/components/InvoiceSortingOptions'
import {ChevronLeftIcon, MoreHorizontalIcon} from 'vue-feather-icons'
import PopoverWrapper from '@/components/Desktop/PopoverWrapper'
import ToolbarWrapper from '@/components/Desktop/ToolbarWrapper'
@@ -80,7 +72,7 @@
export default {
name: 'InvoiceDesktopToolbar',
components: {
FileSortingOptions,
InvoiceSortingOptions,
MoreHorizontalIcon,
ChevronLeftIcon,
ToolbarWrapper,
@@ -118,10 +110,6 @@
data() {
return {
query: '',
filter: {
sort: 'DESC',
field: undefined
}
}
},
watch: {
@@ -130,24 +118,6 @@
}
},
methods: {
sort(field) {
this.filter.field = field
// Set sorting direction
if (this.filter.sort === 'DESC')
this.filter.sort = 'ASC'
else if (this.filter.sort === 'ASC')
this.filter.sort = 'DESC'
// Save to localStorage sorting options
localStorage.setItem('sorting-invoices', JSON.stringify({ sort: this.filter.sort, field: this.filter.field }))
// Update sorting state in vuex
this.$store.commit('UPDATE_INVOICE_SORTING')
// Get data using the application location
this.$getInvoiceDataByLocation()
},
createInvoice(type) {
this.$router.push({name: 'CreateInvoice', query: {type: type}})
},