Add customer view support for orders table component
Introduced the `isCustomerView` prop to conditionally customize the orders table display. Adjusted columns and UI elements to hide cashier and customer information when in customer view. Updated related pagination logic to integrate the modified orders table.
This commit is contained in:
@@ -14,6 +14,10 @@ const props = defineProps({
|
||||
allowSelectMultiple: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isCustomerView: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
});
|
||||
import {ref, watch} from 'vue';
|
||||
@@ -220,16 +224,16 @@ const tableHeaders = ref([
|
||||
title: 'Id',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
...(props.isCustomerView) ? [] : [{
|
||||
name: 'customer_id',
|
||||
title: 'Kunde',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
}],
|
||||
...(props.isCustomerView) ? [] : [{
|
||||
name: 'cashier_id',
|
||||
title: 'Kassør',
|
||||
sortable: true,
|
||||
},
|
||||
}],
|
||||
{
|
||||
name: 'department_id',
|
||||
title: 'Afdeling',
|
||||
@@ -665,7 +669,7 @@ const confirmCloseModal = () => {
|
||||
}"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<td v-if="!props.isCustomerView">
|
||||
<ColorIndicator
|
||||
v-bind:label="{
|
||||
text: order.customer_name,
|
||||
@@ -711,7 +715,7 @@ const confirmCloseModal = () => {
|
||||
{{ order.customer_name }}
|
||||
</span>
|
||||
</td> -->
|
||||
<td>{{ order.cashier_id }}</td>
|
||||
<td v-if="!props.isCustomerView">{{ order.cashier_id }}</td>
|
||||
<td>{{ getDepartmentName(order.department_id) }}</td>
|
||||
<td>
|
||||
<ColorIndicator
|
||||
|
||||
@@ -31,7 +31,7 @@ const props = defineProps({
|
||||
default: true
|
||||
}
|
||||
})
|
||||
setEndpoint("/user/orders", false);
|
||||
setEndpoint("/orders", false);
|
||||
if (props.onlyFromInvoiceCollection > 0) {
|
||||
setFilter("invoice_collection_id", props.onlyFromInvoiceCollection, false);
|
||||
}
|
||||
@@ -45,7 +45,11 @@ if (props.autoLoad) {
|
||||
<template>
|
||||
<input @input="search($event.target.value)" class="input mt-2" type="text" placeholder="Søg efter vask" v-model="metaSearch" />
|
||||
<PaginationDisplay :metaItemsPerPage="metaItemsPerPage" :loadFunction="loadList" :isLoading="isLoading" :setMetaItemsPerPage="setMetaItemsPerPage" />
|
||||
<invoicesTable :objects="list" />
|
||||
<!-- <invoicesTable :objects="list" /> -->
|
||||
<orders-table
|
||||
v-bind:orders="list"
|
||||
v-bind:is-customer-view="true"
|
||||
/>
|
||||
<PaginationNavigation :currentPage="metaCurrentPage" :totalPages="Math.ceil(metaTotalItems / metaItemsPerPage)" :loadFunction="loadList" :setPage="setPage" :isLoading="isLoading" />
|
||||
<LoadButtonWhileAwait class="is-dark" :isLoading="isLoading" :loadFunction="loadList" icon="fas fa-sync-alt">Reload</LoadButtonWhileAwait>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user